System.Windows.Forms.ToolStripItem Class

Represents the abstract base class that manages events and layout for all the elements that a System.Windows.Forms.ToolStrip or System.Windows.Forms.ToolStripDropDown can contain.

See Also: ToolStripItem Members

Syntax

[System.ComponentModel.Designer("System.Windows.Forms.Design.ToolStripItemDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.ToolboxItem(false)]
[System.ComponentModel.DesignTimeVisible(false)]
[System.ComponentModel.DefaultProperty("Text")]
[System.ComponentModel.DefaultEvent("Click")]
public abstract class ToolStripItem : System.ComponentModel.Component, IDropTarget

Remarks

A System.Windows.Forms.ToolStripItem is an element such as a button, combo box, text box, or label that can be contained in a System.Windows.Forms.ToolStrip control or a System.Windows.Forms.ToolStripDropDown control, which is similar to a Windows shortcut menu. The System.Windows.Forms.ToolStrip class manages the painting and keyboard and mouse input, including drag-and-drop input, for these elements, and the System.Windows.Forms.ToolStripItem class manages events and layout within the elements themselves.

System.Windows.Forms.ToolStripItem classes either inherit directly from System.Windows.Forms.ToolStripItem, or they inherit indirectly from System.Windows.Forms.ToolStripItem through System.Windows.Forms.ToolStripControlHost or System.Windows.Forms.ToolStripDropDownItem.

System.Windows.Forms.ToolStripItem controls must be contained in a System.Windows.Forms.ToolStrip, System.Windows.Forms.MenuStrip, System.Windows.Forms.StatusStrip, or System.Windows.Forms.ContextMenuStrip and cannot be added directly to a form. The various container classes are designed to contain an appropriate subset of System.Windows.Forms.ToolStripItem controls.

Note   A given System.Windows.Forms.ToolStripItem cannot have more than one parent System.Windows.Forms.ToolStrip. You must copy of the System.Windows.Forms.ToolStripItem and add it to other System.Windows.Forms.ToolStrip controls.

The following table shows the elements that derive from the System.Windows.Forms.ToolStripItem class and which therefore can be hosted in a System.Windows.Forms.ToolStrip or System.Windows.Forms.ToolStripDropDown.

System.Windows.Forms.ToolStripButton

A toolbar button that supports images and text.

System.Windows.Forms.ToolStripLabel

A text label typically used in a status bar or System.Windows.Forms.ToolStrip as a comment or title.

System.Windows.Forms.ToolStripSeparator

A non-selectable space or space with a vertical bar that visually groups elements.

System.Windows.Forms.ToolStripControlHost

A System.Windows.Forms.ToolStripItem that hosts a System.Windows.Forms.ToolStripComboBox, System.Windows.Forms.ToolStripTextBox, System.Windows.Forms.ToolStripProgressBar, other Windows Forms controls, or custom controls.

A System.Windows.Forms.ToolStripComboBox is a text box in which the user can enter text, along with a list from which the user can select text to fill the text box.

A System.Windows.Forms.ToolStripTextBox enables the user to enter text.

A System.Windows.Forms.ToolStripProgressBar represents a Windows progress bar control contained in a System.Windows.Forms.StatusStrip.

System.Windows.Forms.ToolStripDropDownItem

A System.Windows.Forms.ToolStripItem that hosts a System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms.ToolStripSplitButton, and System.Windows.Forms.ToolStripDropDownButton.

A System.Windows.Forms.ToolStripMenuItem is a selectable option displayed on a menu or context menu.

A System.Windows.Forms.ToolStripSplitButton is a combination of a regular button and a drop-down button.

A System.Windows.Forms.ToolStripDropDownButton is a button that supports drop-down functionality.

System.Windows.Forms.ToolStripStatusLabel

A panel in a System.Windows.Forms.StatusStrip control.

Requirements

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