共用方式為


ToolStrip.Items 屬性

定義

取得所有屬於 ToolStrip.

public:
 virtual property System::Windows::Forms::ToolStripItemCollection ^ Items { System::Windows::Forms::ToolStripItemCollection ^ get(); };
public virtual System.Windows.Forms.ToolStripItemCollection Items { get; }
member this.Items : System.Windows.Forms.ToolStripItemCollection
Public Overridable ReadOnly Property Items As ToolStripItemCollection

屬性值

一個型為 ToolStripItemCollection的物件,代表包含於 的所有元素 ToolStrip

範例

以下程式碼範例將一組項目加入 ToolStrip

this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] 
            {
            this.newToolStripButton,
            this.openToolStripButton,
            this.saveToolStripButton,
            this.printToolStripButton,
            this.toolStripSeparator,
            this.cutToolStripButton,
            this.copyToolStripButton,
            this.pasteToolStripButton,
            this.toolStripSeparator1,
            this.helpToolStripButton});
Me.toolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.newToolStripButton, Me.openToolStripButton, Me.saveToolStripButton, Me.printToolStripButton, Me.toolStripSeparator, Me.cutToolStripButton, Me.copyToolStripButton, Me.pasteToolStripButton, Me.toolStripSeparator1, Me.helpToolStripButton})

備註

使用 Items 收藏庫來檢索所有已加入的 ToolStrip項目,而不只是顯示的項目。 即使該項目是溢出項目,仍保留在 Items 集合中,因此目前不可見。

使用該 DisplayedItems 屬性只取得目前顯示在 ToolStrip.

適用於

另請參閱