我原来的程序是用Picture1.Line画线的,现在想改为用MoveToEx和LineTo画线。但是好像不对
原来的画线程序如下:
Dim y1, y11 As Integer
Picture1.ScaleMode = 1
Picture1.Refresh
Picture1.Scale (-100, 290)-(10000, -10)
If t > 10000 Or t < 0 Then
t = 0
Picture1.Cls
End If
y11 = y(0)          '数据保存在y()数组中
For n = 1 To intInputLen
y1 = y(n - 1)
Picture1.Line (t, y11)-(t + 1, y1), vbRed
y11 = y1
t = t + 1
Next n
上面的程序能工作,就是比较慢。
后来用API函数画,改为如下:
Dim y1, y11 As Integer
Picture1.ScaleMode = 1
Picture1.Refresh
Picture1.Scale (-100, 290)-(10000, -10)If t > 10000 Or t < 0 Then
t = 0
Picture1.Cls
End If
For n = 1 To intInputLen
point.x = t: point.y = y(n - 1): y11 = y(n - 1)
MoveToEx Picture1.hdc, t, y11, point
y1 = y(n)
LineTo Picture1.hdc, t + 1, y1
t = t + 1
Picture1.Refresh
Next n
程序倒是能运行,可是不对,当y为0时,却画在上面,而且画线出了10000后也不回来???
另外怎么改变画线条的颜色?