MenuStrip Control Overview (Windows Forms)
Menus expose functionality to your users by holding commands that are grouped by a common theme.
The MenuStrip control is new to this version of Visual Studio and the .NET Framework. With the control, you can easily create menus like those found in Microsoft Office.
The MenuStrip control supports the multiple-document interface (MDI) and menu merging, tool tips, and overflow. You can enhance the usability and readability of your menus by adding access keys, shortcut keys, check marks, images, and separator bars.
The MenuStrip control replaces and adds functionality to the MainMenu control; however, the MainMenu control is retained for backward compatibility and future use if you choose.
Ways to Use the MenuStrip Control
Use the MenuStrip control to:
Create easily customized, commonly employed menus that support advanced user interface and layout features, such as text and image ordering and alignment, drag-and-drop operations, MDI, overflow, and alternate modes of accessing menu commands.
Support the typical appearance and behavior of the operating system.
Handle events consistently for all containers and contained items, in the same way you handle events for other controls.
The following table shows some particularly important properties of MenuStrip and associated classes.
Property |
Description |
---|---|
Gets or sets the ToolStripMenuItem that is used to display a list of MDI child forms. |
|
Gets or sets how child menus are merged with parent menus in MDI applications. |
|
Gets or sets the position of a merged item within a menu in MDI applications. |
|
Gets or sets a value indicating whether the form is a container for MDI child forms. |
|
Gets or sets a value indicating whether tool tips are shown for the MenuStrip. |
|
Gets or sets a value indicating whether the MenuStrip supports overflow functionality. |
|
Gets or sets the shortcut keys associated with the ToolStripMenuItem. |
|
Gets or sets a value indicating whether the shortcut keys that are associated with the ToolStripMenuItem are displayed next to the ToolStripMenuItem. |
The following table shows the important MenuStrip companion classes.
Class |
Description |
---|---|
Represents a selectable option displayed on a MenuStrip or ContextMenuStrip. |
|
Represents a shortcut menu. |
|
Represents a control that allows the user to select a single item from a list that is displayed when the user clicks a ToolStripDropDownButton or a higher-level menu item. |
|
Provides basic functionality for controls derived from ToolStripItem that display drop-down items when clicked. |