ToolStrip.CreateDefaultItem(String, Image, EventHandler) Method

Definition

Creates a default ToolStripItem with the specified text, image, and event handler on a new ToolStrip instance.

C#
protected internal virtual System.Windows.Forms.ToolStripItem CreateDefaultItem(string text, System.Drawing.Image image, EventHandler onClick);
C#
protected internal virtual System.Windows.Forms.ToolStripItem CreateDefaultItem(string? text, System.Drawing.Image? image, EventHandler? onClick);

Parameters

text
String

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

image
Image

The Image to display on the ToolStripItem.

onClick
EventHandler

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

Returns

A ToolStripButton(String, Image, EventHandler), or a ToolStripSeparator if the text parameter is a hyphen (-).

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9