We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Platform : WinForms
Category : Menus

How do I control the position of the context menu when it is invoked via the keyboard?

Normally, the context menu will be shown at the center of the control when the keyboard is used to invoke the context menu of a control (Shift+F10, for example). You can customize the location as follows.
  1. Override WndProc in the grid and check if the Message.Msg is WM_CONTEXTMENU (0x007b)
  2. If so, check if the Message.LParam is -1, which means this was due to a keyboard message as opposed to the user right-clicking the mouse.
  3. Now, call the associated ContextMenu’s Show method explicitly at the selected row position.
  4. Make sure NOT to call the base class after showing the menu explicitly.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon