vb.net 谁能帮我把这个获取鼠标位置的模块给改成.net 的模块啊?谢谢了
模块内容:Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Function GetX() As Long
Dim n As POINTAPI
GetCursorPos n
GetX = n.X
End Function
'Download by http://www.
Public Function GetY() As Long
Dim n As POINTAPI
GetCursorPos n
GetY = n.Y
End Function
窗体内容:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MouseExit As Boolean
MouseExit = (0 <= X) And (X <= Picture1.Width) And (0 <= Y) And (Y <= Picture1.Height)
If MouseExit Then
Label3.Caption = "鼠标进入了图片"
SetCapture Picture1.hWnd
Else
Label3.Caption = "鼠标离开了图片"
ReleaseCapture
End If
End Sub
Private Sub Timer1_Timer()
Dim n As POINTAPI
GetCursorPos n
Text1.Text = n.X
Text2.Text = n.Y
End Sub
求帮我改成语言,谢谢了!