Click to See Complete Forum and Search --> : Mouseout event ?


inhumanoid
November 1st, 1999, 10:27 AM
How can I mimic a mouseout event on a label ?? mouseover is like mousein but what about mouseout ??

Chris Eastwood
November 1st, 1999, 04:12 PM
You're going to find it tricky providing a 'mouseleave' event for a label. A 'mouseleave' message can be captured on most controls that have an 'HWND' property by using the SetCapture and ReleaseCapture API calls - however, a Label control is 'Window-less' - that is, it's painted on the container at run-time.

You could check for a mouse-move event on every other control on your form (including the form itself) to make sure that the mouse is no longer inside the label.

Another way would be to create your own label control from a VB UserControl so that you can capture the mouse messages correctly.

VBAccelerator have a great article (and great code) available at http://vbaccelerator.com/codelib/ssubtmr/msleave.htm that covers just about every method of providing a mouse-leave event.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb