Udostępnij za pośrednictwem


ToolStrip.Items Właściwość

Definicja

Pobiera wszystkie elementy należące do elementu 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

Wartość właściwości

Obiekt typu ToolStripItemCollection, reprezentujący wszystkie elementy zawarte przez element ToolStrip.

Przykłady

Poniższy przykład kodu dodaje kolekcję elementów do obiektu 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})

Uwagi

Użyj kolekcji Items , aby pobrać wszystkie elementy, które zostały dodane do elementu ToolStrip, a nie tylko wyświetlane elementy. Element pozostaje w kolekcji Items , nawet jeśli jest to element przepełnienia i dlatego nie jest obecnie widoczny.

DisplayedItems Użyj właściwości , aby pobrać tylko elementy, które są obecnie wyświetlane w obiekcie ToolStrip.

Dotyczy

Zobacz też