Sdílet prostřednictvím


ToolBar.ToolBarButtonCollection.RemoveAt(Int32) Metoda

Definice

Odebere dané tlačítko z kolekce tlačítek panelu nástrojů.

public:
 virtual void RemoveAt(int index);
public void RemoveAt(int index);
abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

Parametry

index
Int32

Indexované umístění ToolBarButton v kolekci.

Implementuje

Výjimky

Hodnota index je menší než 0 nebo je větší než počet tlačítek v kolekci.

Příklady

Následující příklad kódu odebere poslední ToolBarButton na .ToolBar Hodnota indexu odebraného tlačítka panelu nástrojů je nastavena na hodnotu rovna Count vlastnosti minus jedna, protože ToolBarButton kolekce je index založený na nule.

public:
   void RemoveMyButton()
   {
      int btns;
      btns = toolBar1->Buttons->Count;
      
      // Remove the last toolbar button.
      toolBar1->Buttons->RemoveAt( btns - 1 );
   }
public void RemoveMyButton()
 {
    int btns;
    btns = toolBar1.Buttons.Count;
 
    // Remove the last toolbar button.
    toolBar1.Buttons.RemoveAt(btns - 1);
 }
Public Sub RemoveMyButton()
    Dim btns As Integer
    btns = toolBar1.Buttons.Count
    
    ' Remove the last toolbar button.
    toolBar1.Buttons.RemoveAt(btns - 1)
End Sub

Poznámky

Metoda Remove odebere v ToolBarButton zadaném umístění v souboru ToolBar.ToolBarButtonCollection. Pokud chcete odebrat všechny ToolBarButton ovládací prvky z kolekce, použijte metodu Clear .

Platí pro

Viz také