Capture mouse click before control
Posted on 2008-11-19
I am developing a Windows Form application with C# .NET 2.0.
In my form, I have many controls and panels on it. I need to capture a mouse click within the form before any of the controls or panels do.
What I'm trying to do is to mimic the dropdown menu in Microsoft Word 2007. In Word 2007, if you click on the top left menu button, a dropdown menu will appear. If you click anywhere outside of that menu, the menu will disappear/close.
I did it right now by having a menu panel that is "floating" on top of other controls. So if the user clicks anywhere outside of that menu panel, that menu panel show "close" (by setting the Visible to false). But I can't figure out how to capture a mouse click outside of that panel unless I put mouse event listener on every controls outside of that panel, which is something I'm trying to avoid.
Any help is appreciated. Thanks!