ToolStripItemCollection.Add 方法

定義

ToolStripItem 加入集合。

多載

Add(Image)

將顯示指定影像的 ToolStripItem 加入集合中。

Add(String)

將顯示指定文字的 ToolStripItem 加入集合中。

Add(ToolStripItem)

將指定的項目加入至集合的尾端。

Add(String, Image)

將顯示指定影像和文字的 ToolStripItem 加入集合中。

Add(String, Image, EventHandler)

將顯示指定影像和文字並引發 ToolStripItem 事件的 Click 加入集合中。

Add(Image)

將顯示指定影像的 ToolStripItem 加入集合中。

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::Drawing::Image ^ image);
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
Public Function Add (image As Image) As ToolStripItem

參數

image
Image

要顯示在 Image 上的 ToolStripItem

傳回

新的 ToolStripItem

適用於

Add(String)

將顯示指定文字的 ToolStripItem 加入集合中。

public:
 System::Windows::Forms::ToolStripItem ^ Add(System::String ^ text);
public System.Windows.Forms.ToolStripItem Add (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 上的文字。

傳回

新的 ToolStripItem

適用於

Add(ToolStripItem)

將指定的項目加入至集合的尾端。

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

要加入集合結尾的 ToolStripItem

傳回

Int32,表示集合中新項目之以零起始的索引。

例外狀況

value 參數為 null

適用於

Add(String, Image)

將顯示指定影像和文字的 ToolStripItem 加入集合中。

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);
public System.Windows.Forms.ToolStripItem Add (string? text, System.Drawing.Image? image);
member this.Add : string * System.Drawing.Image -> System.Windows.Forms.ToolStripItem
Public Function Add (text As String, image As Image) As ToolStripItem

參數

text
String

要顯示於 ToolStripItem 上的文字。

image
Image

要顯示在 Image 上的 ToolStripItem

傳回

新的 ToolStripItem

適用於

Add(String, Image, EventHandler)

將顯示指定影像和文字並引發 ToolStripItem 事件的 Click 加入集合中。

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);
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
Public Function Add (text As String, image As Image, onClick As EventHandler) As ToolStripItem

參數

text
String

要顯示於 ToolStripItem 上的文字。

image
Image

要顯示在 Image 上的 ToolStripItem

onClick
EventHandler

引發 Click 事件。

傳回

新的 ToolStripItem

適用於