Прочетете на английски Редактиране

Споделяне чрез


ToolStripItemCollection.Add Method

Definition

Adds a ToolStripItem to the collection.

Overloads

Add(Image)

Adds a ToolStripItem that displays the specified image to the collection.

Add(String)

Adds a ToolStripItem that displays the specified text to the collection.

Add(ToolStripItem)

Adds the specified item to the end of the collection.

Add(String, Image)

Adds a ToolStripItem that displays the specified image and text to the collection.

Add(String, Image, EventHandler)

Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.

Add(Image)

Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs

Adds a ToolStripItem that displays the specified image to the collection.

public System.Windows.Forms.ToolStripItem Add (System.Drawing.Image image);
public System.Windows.Forms.ToolStripItem Add (System.Drawing.Image? image);

Parameters

image
Image

The Image to be displayed on the ToolStripItem.

Returns

The new ToolStripItem.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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

Add(String)

Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs

Adds a ToolStripItem that displays the specified text to the collection.

public System.Windows.Forms.ToolStripItem Add (string text);
public System.Windows.Forms.ToolStripItem Add (string? text);

Parameters

text
String

The text to be displayed on the ToolStripItem.

Returns

The new ToolStripItem.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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

Add(ToolStripItem)

Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs

Adds the specified item to the end of the collection.

public int Add (System.Windows.Forms.ToolStripItem value);

Parameters

value
ToolStripItem

The ToolStripItem to add to the end of the collection.

Returns

An Int32 representing the zero-based index of the new item in the collection.

Exceptions

The value parameter is null.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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

Add(String, Image)

Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs

Adds a ToolStripItem that displays the specified image and text to the collection.

public System.Windows.Forms.ToolStripItem Add (string text, System.Drawing.Image image);
public System.Windows.Forms.ToolStripItem Add (string? text, System.Drawing.Image? image);

Parameters

text
String

The text to be displayed on the ToolStripItem.

image
Image

The Image to be displayed on the ToolStripItem.

Returns

The new ToolStripItem.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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

Add(String, Image, EventHandler)

Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs
Source:
ToolStripItemCollection.cs

Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.

public System.Windows.Forms.ToolStripItem Add (string text, System.Drawing.Image image, EventHandler onClick);
public System.Windows.Forms.ToolStripItem Add (string? text, System.Drawing.Image? image, EventHandler? onClick);

Parameters

text
String

The text to be displayed on the ToolStripItem.

image
Image

The Image to be displayed on the ToolStripItem.

onClick
EventHandler

Raises the Click event.

Returns

The new ToolStripItem.

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.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