Another popular type of menus is context menus. You use ContextMenu controls to give users access to frequently used menu commands, and bring them up by right-clicking another control. You can see a context menu at work in the ContextMenus example on the CD-ROM in Figure 9.2. You usually use context menus to display control-specific options, such as Cut, Copy, and Paste in text boxes.
You associate context menus with other controls by setting the control's ContextMenu property to the ContextMenu control. The central property of the ContextMenu control is the MenuItems property; you can add menu items to a context menu at design time or in code by creating MenuItem objects and adding them to the MenuItems collection of the context menu.
As with main menus, context menu items can be disabled, hidden, or deleted. You also can show and hide context menus yourself with the ContextMenu control's Show and Hide methods. You can handle the menu item's Click, Select, and Popup events, as you can in main menus. In fact, the only major difference here is that context menus are not divided into separate menus, like File, Edit, Window, and so on.
A context menu can be associated with a number of other controls, but as you'd expect, each control can have only one context menu.
You can reuse MenuItem objects from a main menu in a context menu if you use the CloneMenu method of the MenuItem class.