+ -
当前位置:首页 → 问答吧 → 给位牛人多指教 曲线显示问题 着急

给位牛人多指教 曲线显示问题 着急

时间:2011-08-30

来源:互联网

下面是程序的曲线显示部分
Private Sub Timer1_Timer()
Dim t As Single
Dim xAs Single
If data > 1 Then
t = 2 * data - 2
Else
t = 0
End If
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.DrawWidth = 3
x = data
Picture1.pset(x,t)
If x> 5 Then
Picture1.Cls
x = 0
Call draw
End If
End Sub
Data是串口接收后处理得到的数据,现在我想让在我的数据(x,t)显示成一条连续的曲线,可是我发现pset显示的是点 不是线 请各位大牛指导下吧 可在源程序上修改 急啊 多帮忙 我试过数组之类 用过line 都不行 能力有限 多指教吧

作者: likejialibai1986   发布时间: 2011-08-30

你该公开Draw的代码

作者: Veron_04   发布时间: 2011-08-30

好的 我马上发 这是draw部分的代码  
Private Sub draw()
Dim x As Single
Dim y As Single
Picture1.Scale (-0.5, 8)-(6, -0.5) ' 定义坐标系
'画坐标系
Picture1.ForeColor = RGB(200, 5, 200)
Picture1.DrawWidth = 1
Picture1.Line (0, 0)-(0, 7.5)
Picture1.Line (0, 0)-(5.5, 0)
Picture1.CurrentX = 5.5: Picture1.CurrentY = 0: Picture1.Print "V"
Picture1.CurrentX = 0: Picture1.CurrentY = 7.5: Picture1.Print "mm"
For i = 1 To 5 Step 1 ' 在X轴上标记坐标刻度
  If i > 0 Then
  Picture1.CurrentX = i: Picture1.CurrentY = -0.1: Picture1.Print i / 1 '分刻度
  End If
  Next i
For i = 1 To 6 Step 1 ' 在X轴上标记坐标刻度
  If i > 0 Then
  Picture1.CurrentX = -0.2: Picture1.CurrentY = i: Picture1.Print i / 1 '分刻度
  End If
  Next i
'位置坐标系
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.DrawWidth = 2
For y = 0 To 7 Step 0.1
Picture1.PSet (0, y)
Next y
'细分坐标轴等分化
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.DrawWidth = 4
Picture1.PSet (0, 1)
Picture1.PSet (0, 2)
Picture1.PSet (0, 3)
Picture1.PSet (0, 4)
Picture1.PSet (0, 5)
Picture1.PSet (0, 6)
Picture1.PSet (0, 7)
'绘制时间坐标轴,此需要处理编程电压形式
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.DrawWidth = 2
For x = 0 To 5 Step 0.1
Picture1.PSet (x, 0)
Next x
'分点等分坐标轴
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.DrawWidth = 4
Picture1.PSet (1, 0)
Picture1.PSet (2, 0)
Picture1.PSet (3, 0)
Picture1.PSet (4, 0)
Picture1.PSet (5, 0)
End Sub

作者: likejialibai1986   发布时间: 2011-08-30