Context Menus
In some applications, you can right-click on certain user interface artifacts and a menu pops up. This is commonly referred to as a pop-up menu or context menu. This ability is also provided to you in Microsoft .NET as part of Windows Forms.
All of the examples shown in this chapter have so far used a MainMenu object as the root container of all the MenuItems. As already demonstrated, the MainMenu object supports displaying menus across a menu bar in your form.
To implement context menus, you would instead use an instance of ContextMenu instead of MainMenu. Everything explained so far in relation to MainMenu also applies to ContextMenu. The only difference is that a context menu can appear at different locations on your screen. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access