System.Windows.Forms.ToolStripMenuItem Class

Represents a selectable option displayed on a System.Windows.Forms.MenuStrip or System.Windows.Forms.ContextMenuStrip. Although System.Windows.Forms.ToolStripMenuItem replaces and adds functionality to the System.Windows.Forms.MenuItem control of previous versions, System.Windows.Forms.MenuItem is retained for both backward compatibility and future use if you choose.

See Also: ToolStripMenuItem Members

Syntax

[System.ComponentModel.Design.Serialization.DesignerSerializer("System.Windows.Forms.Design.ToolStripMenuItemCodeDomSerializer, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.MenuStrip | System.Windows.Forms.Design.ToolStripItemDesignerAvailability.ContextMenuStrip)]
public class ToolStripMenuItem : ToolStripDropDownItem

Remarks

System.Windows.Forms.ToolStripMenuItem is a System.Windows.Forms.ToolStripDropDownItem that works with System.Windows.Forms.ToolStripDropDownMenu and System.Windows.Forms.ContextMenuStrip to handle the special highlighting, layout, and column arrangement for menus.

In order for a System.Windows.Forms.ToolStripMenuItem to be displayed, you must add it to a System.Windows.Forms.MenuStrip or System.Windows.Forms.ContextMenuStrip.

The System.Windows.Forms.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 ToolStripMenuItem.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 System.Windows.Forms.TextBox control, use the ToolStripMenuItem.Checked property to identify which color is currently selected. Use the ToolStripMenuItem.ShortcutKeys property to define a keyboard combination that can be pressed to select the menu item.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0