vb中的坐标捕捉
vb中的坐标捕捉。鼠标单击的时候返回单击点的坐标。之前是一个图片,图片被载入之后网格化,有没有网格约束都可以,有了更好。怎么做?
--------------------编程问答--------------------
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Debug.Print X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY
End Sub
--------------------编程问答--------------------
Private Sub Form_Load()
Picture1.ScaleMode = vbPixels '用像素单位比较符合图片坐标'
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Debug.Print X, Y
End If
End Sub
补充:VB , 基础类