Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ’Button可以判断左右键 ’X和Y可以判断区域 End Sub为什么要搞得那么复杂呢?
大哥,不是VB~~~API有这个函数可以用吗?
Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As LongPublic Declare Function ScreenToClient Lib "user32" Alias "ScreenToClient" (ByVal hwnd As Long, lpPoint As POINTAPI) As LongPublic Type POINTAPI x As Long y As Long End Type不过要转换一下,比较麻烦
BOOL GetCursorPos( LPPOINT lpPoint // address of structure for cursor position );BOOL ScreenToClient( HWND hWnd, // window handle for source coordinates LPPOINT lpPoint // address of structure containing coordinates );
’Button可以判断左右键
’X和Y可以判断区域
End Sub为什么要搞得那么复杂呢?
x As Long
y As Long
End Type不过要转换一下,比较麻烦
LPPOINT lpPoint // address of structure for cursor position
);BOOL ScreenToClient(
HWND hWnd, // window handle for source coordinates
LPPOINT lpPoint // address of structure containing coordinates
);
Xm, Ym鼠标坐标正切值(Yo-Ym)/(Xm-Xo)