Dim x1 As Integer, y1 As Integer Dim x2 As Integer, y2 As Integer Dim j As Integer Dim i As Integer Dim array1(1 To 2, 1 To 6) As Integer '用来记录所点6个点的坐标 Private Sub Form_Load() Picture1.ScaleMode = 3 End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) i = i + 1 If i > 6 Then MsgBox "你已经输入了6个点" Exit Sub End If Picture1.Line (X - 5, Y - 5)-(X + 5, Y + 5), QBColor(11)'用两条交叉线显示点的位置 Picture1.Line (X - 5, Y + 5)-(X + 5, Y - 5), QBColor(11) array1(1, i) = X: array1(2, i) = Y End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If i > 6 Then For j = 1 To 6 If X = array1(1, j) And Y = array1(2, j) Then Picture1.PSet (X, Y), RGB(255, 0, 0) '一个点用pset是看不出来慢的 Text1.Text = X: Text2.Text = Y End If Next j Else Exit Sub End If End Sub上面的代码可以满足你的要求,不过哪个红点好小啊,你自己看看要不要画个圆之类的一提高可视度。当然,还要根据你自己的实际情况作相应的修改啊。
Dim x2 As Integer, y2 As Integer
Dim j As Integer
Dim i As Integer
Dim array1(1 To 2, 1 To 6) As Integer '用来记录所点6个点的坐标
Private Sub Form_Load()
Picture1.ScaleMode = 3
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
i = i + 1
If i > 6 Then
MsgBox "你已经输入了6个点"
Exit Sub
End If
Picture1.Line (X - 5, Y - 5)-(X + 5, Y + 5), QBColor(11)'用两条交叉线显示点的位置
Picture1.Line (X - 5, Y + 5)-(X + 5, Y - 5), QBColor(11)
array1(1, i) = X: array1(2, i) = Y
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If i > 6 Then
For j = 1 To 6
If X = array1(1, j) And Y = array1(2, j) Then
Picture1.PSet (X, Y), RGB(255, 0, 0) '一个点用pset是看不出来慢的
Text1.Text = X: Text2.Text = Y
End If
Next j
Else
Exit Sub
End If
End Sub上面的代码可以满足你的要求,不过哪个红点好小啊,你自己看看要不要画个圆之类的一提高可视度。当然,还要根据你自己的实际情况作相应的修改啊。