首页 / 软件开发 / VB / 捕捉MouseExit事件
捕捉MouseExit事件2010-03-12MouseDown、MouseUp、MouseMove。VB 似乎提供了很好的 Mouse 事件。但好象还缺少什么!对!还差 MouseExit(鼠标移出)事件。在 VB 中,我们要捕捉 MouseExit 事件,必须用 API 函数:Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As LongPrivate Declare Function ReleaseCapture Lib "user32" () As Long然后,我们可以在控件(以 Picture1 为例)的 MouseMove 事件上加上以下代码:Dim MouseExit As Boolean
MouseOver = (0 $#@60;= X) And (X $#@60;="Picture1.Width)" And (0 $#@60;="Y)" And (Y $#@60;="Picture1.Height)$#@60;Br"$#@62; If MouseExit Then
........
SetCapture Picture1.hWnd
Else
........
ReleaseCapture
End If