ツール バー ボタン コレクションから指定したボタンを削除します。
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
'宣言
Public Sub RemoveAt ( _
index As Integer _
)
'使用
Dim instance As ToolBarButtonCollection
Dim index As Integer
instance.RemoveAt(index)
public void RemoveAt (
int index
)
public:
virtual void RemoveAt (
int index
) sealed
public final void RemoveAt (
int index
)
public final function RemoveAt (
index : int
)
パラメータ
- index
コレクション内の ToolBarButton のインデックス位置。
例外
例外の種類 | 条件 |
---|---|
index の値が 0 未満か、コレクション内のボタン数を超えています。 |
解説
Remove メソッドは、ToolBar.ToolBarButtonCollection 内の指定した位置にある ToolBarButton をコレクションから削除します。すべての ToolBarButton コントロールをコレクションから削除する場合、Clear メソッドを使用します。
使用例
ToolBar 上の最後の ToolBarButton を削除するコード例を次に示します。ToolBarButton コレクションのインデックス値は 0 から始まるため、削除されたツール バー ボタンのインデックス値は Count プロパティと等しい値か、プロパティの値から 1 を引いた値が設定されます。
Public Sub RemoveMyButton()
Dim btns As Integer
btns = toolBar1.Buttons.Count
' Remove the last toolbar button.
toolBar1.Buttons.RemoveAt(btns - 1)
End Sub
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 );
}
プラットフォーム
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0
.NET Compact Framework
サポート対象 : 2.0、1.0
参照
関連項目
ToolBar.ToolBarButtonCollection クラス
ToolBar.ToolBarButtonCollection メンバ
System.Windows.Forms 名前空間
Clear
ToolBarButton
Add