Sign in to follow this  
ArchG

[.net] Catching Mouse Events over Controls (C#, WinForms)

Recommended Posts

Hello, I am kinda trying to make a web browser application, that fades out (changes opacity) when you're not using it, and fades in when the mouse comes back over it. The problem is...I can't find an event that will fire when I bring the mouse over the application. I'm using the Web Browser control, which has no event for MouseOver, MouseEnter or anything like that. And, since I have the WebBrowser, set to Fill (for the Dock Property) it fills up the whole form, and the form will not fire mouse move, or mouse enter events. What do I do? Thanks, ArchG

Share this post


Link to post
Share on other sites
maybe you could create a user control that contains the webbrowser control. This user control could catch mouse events, even let you control the opacity. Since the browser control would be a child control of your user control, it would fade right along with it :-)

Share this post


Link to post
Share on other sites
Thanks for your response.

The problem with that though is first...User controls don't have a property for Opacity..(that doesn't really matter though as I could change the parent controls opacity from there...

the big problem is still with the browser control...the MouseEnter, MouseLeave, and MouseMove events won't fire when the mouse is overtop of the Browser control, even when it is 'embedded'? in the user control...

Any other solutions?

Share this post


Link to post
Share on other sites
As it's the mouse over event for your whole application, you could try using a message filter, so that once your application receives a message you know it's got focus and change the opacity - search for IMessageFilter or PreFilterMessage for examples.

Hope this helps!
Cheers,
Gary

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this