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.

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.

PropertyDescription
MdiWindowListItemGets or sets the ToolStripMenuItem that is used to display a list of MDI child forms.
ToolStripItem.MergeActionGets or sets how child menus are merged with parent menus in MDI applications.
ToolStripItem.MergeIndexGets or sets the position of a merged item within a menu in MDI applications.
Form.IsMdiContainerGets or sets a value indicating whether the form is a container for MDI child forms.
ShowItemToolTipsGets or sets a value indicating whether tool tips are shown for the MenuStrip.
CanOverflowGets or sets a value indicating whether the MenuStrip supports overflow functionality.
ShortcutKeysGets or sets the shortcut keys associated with the ToolStripMenuItem.
ShowShortcutKeysGets 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.

ClassDescription
ToolStripMenuItemRepresents a selectable option displayed on a MenuStrip or ContextMenuStrip.
ContextMenuStripRepresents a shortcut menu.
ToolStripDropDownRepresents 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.
ToolStripDropDownItemProvides basic functionality for controls derived from ToolStripItem that display drop-down items when clicked.

ToolStrip
MenuStrip
ContextMenuStrip
StatusStrip
ToolStripItem
ToolStripDropDown

Show: