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. ...

Get Visual Basic® .NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.