ToolStripMenuItem Class
Assembly: System.Windows.Forms (in system.windows.forms.dll)
ToolStripMenuItem is a ToolStripDropDownItem that works with ToolStripDropDownMenu and ContextMenuStrip to handle the special highlighting, layout, and column arrangement for menus.
In order for a ToolStripMenuItem to be displayed, you must add it to a MenuStrip or ContextMenuStrip.
The ToolStripMenuItem class provides properties that enable you to configure the appearance and functionality of a menu item. To display a check mark next to a menu item, use the Checked property. Use this feature to identify a menu item that is selected in a list of mutually exclusive menu items. For example, if you have a set of menu items for setting the color of text in a TextBox control, use the Checked property to identify which color is currently selected. Use the ShortcutKeys property to define a keyboard combination that can be pressed to select the menu item.
The following code example adds a ShortcutKeyDisplayString to the specified menu items of a ContextMenuStrip. This code example is part of a larger example available in the ToolStripManager class overview.
// Distinguish the merged items by setting the shortcut display string. foreach (ToolStripMenuItem tsmi in cmsItemsToMerge.Items) { tsmi.ShortcutKeyDisplayString = "Merged Item"; }
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.ToolStripItem
System.Windows.Forms.ToolStripDropDownItem
System.Windows.Forms.ToolStripMenuItem
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.