Bewerken

Share via


ToolStripDropDownMenu.CreateDefaultItem(String, Image, EventHandler) Method

Definition

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

protected public:
 override System::Windows::Forms::ToolStripItem ^ CreateDefaultItem(System::String ^ text, System::Drawing::Image ^ image, EventHandler ^ onClick);
protected internal override System.Windows.Forms.ToolStripItem CreateDefaultItem (string text, System.Drawing.Image image, EventHandler onClick);
protected internal override System.Windows.Forms.ToolStripItem CreateDefaultItem (string? text, System.Drawing.Image? image, EventHandler? onClick);
override this.CreateDefaultItem : string * System.Drawing.Image * EventHandler -> System.Windows.Forms.ToolStripItem
Protected Friend Overrides Function CreateDefaultItem (text As String, image As Image, onClick As EventHandler) As ToolStripItem

Parameters

text
String

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

image
Image

The Image to display on the ToolStripMenuItem.

onClick
EventHandler

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

Returns

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

Remarks

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

Applies to