次の方法で共有


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

プロパティ値

ToolStripに含まれるすべての要素を表すToolStripItemCollection型のオブジェクト。

次のコード例では、項目のコレクションを 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 コレクションに残ります。

ToolStripに現在表示されている項目のみを取得するには、DisplayedItems プロパティを使用します。

適用対象

こちらもご覧ください