希望在VB中实现,按command后能依据TXT中数据在picturebox作图并显示,我从网上粘了段语句,但总报错
TXT数据如下xy345.821.09346.201.17348.122.11349.666.78350.817.00351.207.95(太长了不粘了,大致如此,有15...
TXT数据如下
x y
345.82 1.09
346.20 1.17
348.12 2.11
349.66 6.78
350.81 7.00
351.20 7.95 (太长了不粘了,大致如此,有15-18组吧)
本人菜鸟一个,我网上找的那段太长,百度不让粘,所以求助好心人帮助,帮忙写段语句能够实现功能,悬赏不多,全部在此了,希望高人能够直接给段代码,先谢过能施以援手的高人,谢谢了 展开
x y
345.82 1.09
346.20 1.17
348.12 2.11
349.66 6.78
350.81 7.00
351.20 7.95 (太长了不粘了,大致如此,有15-18组吧)
本人菜鸟一个,我网上找的那段太长,百度不让粘,所以求助好心人帮助,帮忙写段语句能够实现功能,悬赏不多,全部在此了,希望高人能够直接给段代码,先谢过能施以援手的高人,谢谢了 展开
2个回答
展开全部
Private Sub Command1_Click()
Dim Msg, XPos, YPos, I
Picture1.Scale (344, 10)-(360, -1)
Picture1.Line (345, 0)-(345, 10)
Picture1.Line (345, 0)-(360, 0)
Open App.Path & "\zb.txt" For Input As #1
Input #1, Msg
I = 0
Do
Input #1, XPos, YPos
Picture1.DrawWidth = 3
If I = 1 Then
Picture1.Line (X1, Y1)-(XPos, YPos)
End If
Picture1.PSet (XPos, YPos)
X1 = XPos
Y1 = YPos
I = 1
Loop While Not EOF(1)
Close #1
End Sub
Dim Msg, XPos, YPos, I
Picture1.Scale (344, 10)-(360, -1)
Picture1.Line (345, 0)-(345, 10)
Picture1.Line (345, 0)-(360, 0)
Open App.Path & "\zb.txt" For Input As #1
Input #1, Msg
I = 0
Do
Input #1, XPos, YPos
Picture1.DrawWidth = 3
If I = 1 Then
Picture1.Line (X1, Y1)-(XPos, YPos)
End If
Picture1.PSet (XPos, YPos)
X1 = XPos
Y1 = YPos
I = 1
Loop While Not EOF(1)
Close #1
End Sub
追问
您好,首先谢谢您,我还想问一下,如果希望能标出横纵坐标及箭头还有横坐标温度,纵坐标压力,需要怎么做
追答
Private Sub Command1_Click()
Dim Msg, XPos, YPos, I, J As Integer
Picture1.Scale (344, 10)-(360, -1)
Picture1.DrawWidth = 3
Picture1.Line (345, 0)-(345, 9.5)
For J = 1 To 9
Picture1.Line (344.9, J)-(345.1, J)
Next J
Picture1.Line (345, 9.5)-(344.8, 9)
Picture1.Line (345, 9.5)-(345.2, 9)
Picture1.Line (345, 0)-(359.5, 0)
For J = 346 To 358
Picture1.Line (J, -0.1)-(J, 0.1)
Next J
Picture1.Line (359.5, 0)-(359, 0.2)
Picture1.Line (359.5, 0)-(359, -0.2)
Picture1.CurrentX = 344
For J = 0 To 9
Picture1.CurrentX = 344.5
Picture1.CurrentY = J
Picture1.Print J
Next J
For J = 345 To 358
Picture1.CurrentX = J - 0.2
Picture1.CurrentY = -0.2
Picture1.Print J
Next J
Open App.Path & "\zb.txt" For Input As #1
Input #1, Msg
I = 0
Do
Input #1, XPos, YPos
If I = 1 Then
Picture1.Line (X1, Y1)-(XPos, YPos)
End If
Picture1.PSet (XPos, YPos)
Picture1.CurrentX = XPos
Picture1.CurrentY = YPos
Picture1.Print "(" & XPos & "," & YPos & ")"
X1 = XPos
Y1 = YPos
I = 1
Loop While Not EOF(1)
Close #1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询