捕捉MouseExit事件 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

   

    MouseDown、MouseUp、MouseMove,

捕捉MouseExit事件

。VB 似乎提供了很好的 Mouse 事件。但好象还缺少什么!对!还差 MouseExit(鼠标移出)事件。在 VB 中,我们要捕捉 MouseExit 事件,必须用 API 函数:

    Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long

    Private 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

最新文章