在vb中输入数据,然后作图。
- 提问者网友:書生途
- 2021-04-26 10:07
- 五星知识达人网友:渊鱼
- 2021-04-26 11:12
可以
这种方式就是最基本的点连线方式,通过你的点的位置和顺序,连接在一起,形成一个图象
给你举个简单的例子
strPoint 变量中存放点的坐标位置,格式 x,y ,多个点用 | 来分开就可以了,窗体上放一个图片框控件
你可以自己输入一些点
Private Sub Command1_Click()
Dim strPoint As String
Dim StartPoint(1 To 2) As Integer
Dim EndPoint(1 To 2) As Integer
Dim arrStr() As String
Dim arrPoint() As String
Dim i As Integer
Picture1.ScaleMode = 3
strPoint = "50|10,80|20,30|50|,100|80,40|20,40|60,60|50,60|100"
arrStr = Split(strPoint, ",")
StartPoint(1) = 100
StartPoint(2) = 100
For i = 0 To UBound(arrStr)
arrPoint = Split(arrStr(i), "|")
EndPoint(1) = arrPoint(0)
EndPoint(2) = arrPoint(1)
Picture1.Line (StartPoint(1), StartPoint(2))-(EndPoint(1), EndPoint(2)), 23
StartPoint(1) = EndPoint(1)
StartPoint(2) = EndPoint(2)
Next i
End Sub