ToolBar.ToolBarButtonCollection.RemoveAt(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從工具列按鈕集合中移除特定按鈕。
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,或大於集合中按鈕的數量。
範例
以下程式碼範例移除 ToolBarButton 了 ToolBar。 被移除的工具列按鈕索引值設 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 方法。