Context Menu Location [Solved]
-
Hi all, Using the Show() method of ContextMenu class ( in Windows.Forms ) it is possible to show a Context Menu. One of the arguments to the Show() method is the top left position of the Context Menu. What I know is, instead of the top left position, the bottom left position of the Context Menu. I would like to translate this somehow to the top left position, however, neither ContextMenu nor MenuItem seem to have a Height or Size property. Does anyone know how to fix the bottom left position of a Context Menu? Any help would be greatly appreciated. Thank you.
modified on Saturday, August 14, 2010 11:23 AM
-
Hi all, Using the Show() method of ContextMenu class ( in Windows.Forms ) it is possible to show a Context Menu. One of the arguments to the Show() method is the top left position of the Context Menu. What I know is, instead of the top left position, the bottom left position of the Context Menu. I would like to translate this somehow to the top left position, however, neither ContextMenu nor MenuItem seem to have a Height or Size property. Does anyone know how to fix the bottom left position of a Context Menu? Any help would be greatly appreciated. Thank you.
modified on Saturday, August 14, 2010 11:23 AM
You could use ContextMenuStrip to create your shortcut menus. That's interchangeable with ContextMenu and has several additional properties and methods including Height and Width.
SG Aham Brahmasmi!
-
You could use ContextMenuStrip to create your shortcut menus. That's interchangeable with ContextMenu and has several additional properties and methods including Height and Width.
SG Aham Brahmasmi!
Thank you for your reply. The ContextMenuStrip has a Size property and can be used to place the Context Menu above the point I want to use. Interestingly, the Size of the ContextMenuStrip is wrong the first time Show is called, so finally I used the method ContextMenuStrip.Show(PointToScreen(p, ToolStripDropDownDirection.AboveRight).