Dim point_currentX, point_currentY '当前坐标
Dim point_recentX, point_recentY '前一点坐标
Dim isfirstpoint As Boolean '判断是否为第一点
Private Sub Form_Load()
isfirstpoint = True
End Sub
'获取当前鼠标点击的X,Y的坐标
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
point_currentX = X
point_currentY = Y
PSet (X, Y)
End Sub
Private Sub Command1_Click()
If isfirstpoint = True Then '把(0,0)改为你自己要求的第一点坐标即可
Picture1.Line (0, 0)-(point_currentX, point_currentY)
point_recentX = point_currentX
point_recentY = point_currentY
isfirstpoint = False
Else '用直线连接前一点与当前点
Picture1.Line (point_recentX, point_recentY)-(point_currentX, point_currentY)
point_recentX = point_currentX
point_recentY = point_currentY
End If
End Sub