[求助]急求助^^如何再VB中检测鼠标坐标??
再VB中怎么能知道鼠标移动再哪啊??如何让VB知道鼠标移动到了什么地方?比如说:在图象左边的区域点击..图象左移等...在图象右边的区域点击..图象右移等...可以实现8个方向的移动...
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI '定义点(Point)结构
X As Long '点在X坐标(横坐标)上的坐标值
Y As Long '点在Y坐标(纵坐标)上的坐标值
End Type
Sub PrintCursorPos()
Dim dl As Long
Dim MyPoint As POINTAPI
dl& = GetCursorPos(MyPoint) '调用函数,获取屏幕鼠标坐标
'Debug.Print "X=" & Str(MyPoint.X) & " and " & "Y=" & Str(MyPoint.Y)
Label1.Caption = "当前横坐标:" & Str(MyPoint.X)
Label2.Caption = "当前纵坐标:" & Str(MyPoint.Y)
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
PrintCursorPos
End Sub
这个不知道怎么用.....有没有在不使用WIN API 的情况下也可以知道鼠标坐标啊?