ToolStripItemCollection.Add 方法

定义

ToolStripItem 添加到集合。Adds a ToolStripItem to the collection.

重载

Add(Image)

将显示指定图像的 ToolStripItem 添加到集合中。Adds a ToolStripItem that displays the specified image to the collection.

Add(String)

将显示指定文本的 ToolStripItem 添加到集合中。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)

将显示指定图像和文本的 ToolStripItem 添加到集合中。Adds a ToolStripItem that displays the specified image and text to the collection.

Add(String, Image, EventHandler)

将显示指定图像和文本并引发 ToolStripItem 事件的 Click 添加到集合中。Adds a ToolStripItem that displays the specified image and text to the collection and that raises the Click event.

Add(Image)

将显示指定图像的 ToolStripItem 添加到集合中。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);
member this.Add : System.Drawing.Image -> System.Windows.Forms.ToolStripItem

参数

image
Image

要在 Image 上显示的 ToolStripItemThe Image to be displayed on the ToolStripItem.

返回

Add(String)

将显示指定文本的 ToolStripItem 添加到集合中。Adds a ToolStripItem that displays the specified text to the collection.

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::String ^ text);
public System.Windows.Forms.ToolStripItem Add (string text);
member this.Add : string -> System.Windows.Forms.ToolStripItem
Public Function Add (text As String) As ToolStripItem

参数

text
String

要在 ToolStripItem 上显示的文本。The text to be displayed on the ToolStripItem.

返回

Add(ToolStripItem)

将指定的项添加到集合末尾。Adds the specified item to the end of the collection.

public:
 int Add(System::Windows::Forms::ToolStripItem ^ value);
public int Add (System.Windows.Forms.ToolStripItem value);
member this.Add : System.Windows.Forms.ToolStripItem -> int
Public Function Add (value As ToolStripItem) As Integer

参数

value
ToolStripItem

要添加到集合末尾的 ToolStripItemThe ToolStripItem to add to the end of the collection.

返回

一个 Int32,表示集合中新项的从零开始的索引。An Int32 representing the zero-based index of the new item in the collection.

异常

value 参数为 nullThe value parameter is null.

Add(String, Image)

将显示指定图像和文本的 ToolStripItem 添加到集合中。Adds a ToolStripItem that displays the specified image and text to the collection.

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::String ^ text, System::Drawing::Image ^ image);
public System.Windows.Forms.ToolStripItem Add (string text, System.Drawing.Image image);
member this.Add : string * System.Drawing.Image -> System.Windows.Forms.ToolStripItem

参数

text
String

要在 ToolStripItem 上显示的文本。The text to be displayed on the ToolStripItem.

image
Image

要在 Image 上显示的 ToolStripItemThe Image to be displayed on the ToolStripItem.

返回

Add(String, Image, EventHandler)

将显示指定图像和文本并引发 ToolStripItem 事件的 Click 添加到集合中。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(System::String ^ text, System::Drawing::Image ^ image, EventHandler ^ onClick);
public System.Windows.Forms.ToolStripItem Add (string text, System.Drawing.Image image, EventHandler onClick);
member this.Add : string * System.Drawing.Image * EventHandler -> System.Windows.Forms.ToolStripItem

参数

text
String

要在 ToolStripItem 上显示的文本。The text to be displayed on the ToolStripItem.

image
Image

要在 Image 上显示的 ToolStripItemThe Image to be displayed on the ToolStripItem.

onClick
EventHandler

引发 Click 事件。Raises the Click event.

返回

适用于