Public Declare Function SetCapture Lib "User32" (ByVal hWnd As Long) As Long
Public Declare Function ReleaseCapture Lib "User32" () As Long
Public Sub MouseExit(t As Variant, x As Single, y As Single)
On Error Resume Next
Dim MouseIn As Boolean
If (x >= 0) And (x <= t.Width) And (y >= 0) And (y < t.Height) Then MouseOut = True
If MouseIn Then
SetCapture t.hWnd
代码……
Else
ReleaseCapture
代码……
End IfEnd Sub在控件的mousemove事件里调用mouseexit函数
Public Declare Function ReleaseCapture Lib "User32" () As Long
Public Sub MouseExit(t As Variant, x As Single, y As Single)
On Error Resume Next
Dim MouseIn As Boolean
If (x >= 0) And (x <= t.Width) And (y >= 0) And (y < t.Height) Then MouseOut = True
If MouseIn Then
SetCapture t.hWnd
代码……
Else
ReleaseCapture
代码……
End IfEnd Sub在控件的mousemove事件里调用mouseexit函数
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货