|
Capturing Mouse Enter (MouseOver) and
Mouse Leave (MouseOut) events:

Category:
System
API:
SetCapture |
GetCapture |
ReleaseCapture
How to capture the MouseEnter and MouseLeave?
Typical example shows you how to capture the MouseEnter (or MouseOver) and
MouseLeave (or MouseOut) events.

Look at this code:
Private Sub
UserControl_MouseMove(Button As Integer, Shift
As Integer, X As Single, Y
As Single)
If ((X < 0)
Or (X > UserControl.Width) Or (Y
< 0) Or (Y > UserControl.Height))
Then
RaiseEvent OnMouseLeave
Call ReleaseCapture
ElseIf GetCapture <>
UserControl.hWnd Then
RaiseEvent OnMouseEnter
Call SetCapture(UserControl.hWnd)
Else
RaiseEvent OnMouseMove(Button,
Shift, X, Y)
End If
End Sub
The SetCapture function sets the mouse capture to the specified window belonging
to the current thread. Once a window has captured the mouse, all mouse input is
directed to that window, even if the mouse rolls out the window.
The ReleaseCapture function releases the mouse capture from a window in the
current thread and restores normal mouse input processing.
The GetCapture function returns the window handle which captures the mouse.
|