Export (0) Print
Expand All

ToolStripMenuItem Class

Note: This class is new in the .NET Framework version 2.0.

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

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public class ToolStripMenuItem : ToolStripDropDownItem
public class ToolStripMenuItem extends ToolStripDropDownItem
public class ToolStripMenuItem extends ToolStripDropDownItem

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 demonstrates the addition of several standard menu items to a File menu of a MenuStrip control. This code example is part of a larger example available in the MenuStrip class overview.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft