Dim px, py As Single
'在image1对象上按下鼠标左健的事件程序Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
px = X
py = Y
End If
End Sub'拖移image1对象的事件程序Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Image1.Move Image1.Left + X - px, Image1.Top + Y - py
Label1.Caption = "(" & Str(Image1.Left / 15) & "," & Str(Image.Top / 15) & ")"
End If
End Sub'送开鼠标左健时候,记录坐标的位置的时间程序。Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Label2.Caption = Label2.Caption & Label1.Caption & ","
End If
End Sub
'在image1对象上按下鼠标左健的事件程序Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
px = X
py = Y
End If
End Sub'拖移image1对象的事件程序Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Image1.Move Image1.Left + X - px, Image1.Top + Y - py
Label1.Caption = "(" & Str(Image1.Left / 15) & "," & Str(Image.Top / 15) & ")"
End If
End Sub'送开鼠标左健时候,记录坐标的位置的时间程序。Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Label2.Caption = Label2.Caption & Label1.Caption & ","
End If
End Sub
好象有点问题,不过不会导致溢出啊:
Dim px As Single, py As Single