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.

傳回

適用於