Hi all,
I am trying to capture the mouse position when a user right-clicks to open a right-click menu.(Eventually i would like the menu items to vary depending what exactly has been clicked on). I have read that there should be a "popup" event which one can use, but i cannot find it! Does anyone know whether or not this is true, or can suggest another way to get the mouse position at this time?
Thanks,
Jon.

AlanRank #669 · 3.6K reputationPosted Aug 16, 2007, 5:50 AM EDT
I'd just handle the control's MouseUp event and check that e.Button == MouseButtons.Right.
If it does then you can get the mouse position and display the ContextMenuStrip for that control.
Jon Foster7 reputationPosted Aug 16, 2007, 6:29 AM EDT
Ah, thanks - will try that...
I already have an OnMouseClick override to handle the left click. It appears that the default context menu functionality as implemented by visual studio takes some kind of precedence as a test "if button clicked = left" type test within this OnMouseClick override was never run.
Thanks again,
Jon.