共用方式為


ToolBar.ToolBarButtonCollection.RemoveAt(Int32) 方法

定義

從工具列按鈕集合中移除特定按鈕。

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)

參數

index
Int32

收藏中 的 ToolBarButton 索引位置。

實作

例外狀況

index 值小於 0,或大於集合中按鈕的數量。

範例

以下程式碼範例移除 ToolBarButtonToolBar。 被移除的工具列按鈕索引值設 Count 為屬性減一,因為該 ToolBarButton 集合是基於零的索引。

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

備註

Remove方法在指定位置ToolBar.ToolBarButtonCollection移除 。ToolBarButton 如果你想從集合中移除所有 ToolBarButton 控制項,就用這個 Clear 方法。

適用於

另請參閱