This documentation is archived and is not being maintained.

ToolStripDropDownMenu.CreateDefaultItem Method

Creates a default ToolStripMenuItem with the specified text, image, and event handler on a new ToolStripDropDownMenu.

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

protected internal override ToolStripItem CreateDefaultItem (
	string text,
	Image image,
	EventHandler onClick
)
protected ToolStripItem CreateDefaultItem (
	String text, 
	Image image, 
	EventHandler onClick
)
protected internal override function CreateDefaultItem (
	text : String, 
	image : Image, 
	onClick : EventHandler
) : ToolStripItem
Not applicable.

Parameters

text

The text to use for the ToolStripMenuItem. If the text parameter is a hyphen (-), this method creates a ToolStripSeparator.

image

The Image to display on the ToolStripMenuItem.

onClick

An event handler that raises the Click event when the ToolStripMenuItem is clicked.

Return Value

A ToolStripMenuItem, or a ToolStripSeparator if the text parameter is a hyphen (-).

Use the CreateDefaultItem method to add a ToolStripMenuItem with commonly used characteristics to a ToolStripDropDownMenu.

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.

.NET Framework

Supported in: 3.0, 2.0
Show: