9.6. Menus

In Windows applications, menus are used to provide a list of commands available for users to execute in the application. Typical examples are the File menu, which may contain such commands as New, Open, Close, Save, and SaveAs, the Edit menu, with commands such as Copy, Cut, and Paste, the Print menu, which may provide such commands as PrintPreview, PageSetup, and Print, and so on.

To create menus in Windows forms applications, we use classes derived from the Menu class that provide the base functionality for all menus. The Menu class serves as a base class for three further classes – the ContextMenu class, used to create shortcut menus, the MainMenu class, used as a container for the menu structure of a form, and the MenuItem class, ...

Get A Programmer's Guide to .NET 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.