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.
Jon FosterPosted Aug 16, 2007, 10:29 AM
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.
AlanPosted Aug 16, 2007, 9:50 AM
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.