VB画记录温度的一个坐标图,X轴时间Y轴温度,每秒温度加1,要有个窗口显示开始输入温度值
展开全部
新建工程,窗体添加一个按钮(Command1)、文本框(Text1)、标签(Label1)、计时器(Timer1)。窗体的AutoRedraw=True
没有具体处理坐标系的问题,相信看了代码可以自己处理的。
Option Explicit
Private nCount As Long
Private cx As Long, cy As Long
Private StartX As Long, StartY As Long
Private XBuf As Long, YBuf As Long
Private Sub Command1_Click()
nCount = Val(Text1.Text)
'坐标原点
cx = 60
cy = 6000
'x增量y增量
XBuf = 60
YBuf = 60
'开始点
StartX = cx + XBuf * nCount
StartY = cy - YBuf * nCount
Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
nCount = nCount + 1
Label1.Caption = nCount
If nCount > 100 Then Timer1.Enabled = False
Me.Cls
'画坐标系
Me.Line (cx, cy)-(cx + 6000, cy) 'x
Me.Line (cx, cy)-(cx, cy - 6000) 'y
Me.CurrentX = 0
Me.CurrentY = 180
Me.Print "温度"
Me.CurrentX = 6060
Me.CurrentY = 5810
Me.Print "时间"
'画线
Me.Line (StartX, StartY)-(StartX + XBuf * nCount, StartY - YBuf * nCount), &H336688
End Sub
没有具体处理坐标系的问题,相信看了代码可以自己处理的。
Option Explicit
Private nCount As Long
Private cx As Long, cy As Long
Private StartX As Long, StartY As Long
Private XBuf As Long, YBuf As Long
Private Sub Command1_Click()
nCount = Val(Text1.Text)
'坐标原点
cx = 60
cy = 6000
'x增量y增量
XBuf = 60
YBuf = 60
'开始点
StartX = cx + XBuf * nCount
StartY = cy - YBuf * nCount
Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
nCount = nCount + 1
Label1.Caption = nCount
If nCount > 100 Then Timer1.Enabled = False
Me.Cls
'画坐标系
Me.Line (cx, cy)-(cx + 6000, cy) 'x
Me.Line (cx, cy)-(cx, cy - 6000) 'y
Me.CurrentX = 0
Me.CurrentY = 180
Me.Print "温度"
Me.CurrentX = 6060
Me.CurrentY = 5810
Me.Print "时间"
'画线
Me.Line (StartX, StartY)-(StartX + XBuf * nCount, StartY - YBuf * nCount), &H336688
End Sub
2012-01-06
展开全部
Visual_Basic与_RS-232_串行通信控制
里面有个 例子,就是 画图的
里面有个 例子,就是 画图的
追问
哪个例子啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询