CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 1999
    Posts
    24

    Mouseout event ?

    How can I mimic a mouseout event on a label ?? mouseover is like mousein but what about mouseout ??


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Mouseout event ?

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured