Is there a way to detect if a right click context menu is opened when i hit a left click on a panel? since the menu will disappear by the time i left click the panel, i cant check it.
I'm not sure that that would be possible. You could handle the Opened event of the ContextMenuStrip and set a flag but you'd have to reset that flag when the menu closes and so you still wouldn't catch it. What are you actually trying to achieve?
I just did a quick test and the Closed event of the ContextMenuStrip is raised before the MouseDown event of the Panel, so I'd say that that's conclusive evidence that you won't be able to do what you want with managed code alone. You may be able to intercept the Windows messages for the two and see if the order of the messages received allows you to detect something in the Panel before the menu is dismissed.
Just be aware that there is always a chance that that approach will fail if the poll occurs at just the right (or wrong, depending on how you look at it) time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.