ToolBar.ToolBarButtonCollectionとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ToolBar.ToolBarButtonCollectionの意味・解説 

ToolBar.ToolBarButtonCollection クラス

ToolBar クラスによって使用される ToolBarButton コントロールのコレクションをカプセル化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Class ToolBarButtonCollection
    Implements IList, ICollection, IEnumerable
Dim instance As ToolBarButtonCollection
public class ToolBarButtonCollection : IList,
 ICollection, IEnumerable
public ref class ToolBarButtonCollection :
 IList, ICollection, IEnumerable
public class ToolBarButtonCollection implements
 IList, ICollection, 
    IEnumerable
public class ToolBarButtonCollection implements
 IList, ICollection, 
    IEnumerable
解説解説
使用例使用例

ToolBar と 3 つの ToolBarButton コントロールを作成および初期化するコード例を次に示します。ツール バー ボタンはツール バーに割り当てられ、ツール バーはフォームに追加されます。このコードは、Form が既に作成されていることを前提にしています。

Public Sub InitializeMyToolBar()
    ' Create and initialize the ToolBarButton controls and ToolBar.
    Dim toolBar1 As New
 ToolBar()
    Dim toolBarButton1 As New
 ToolBarButton()
    Dim toolBarButton2 As New
 ToolBarButton()
    Dim toolBarButton3 As New
 ToolBarButton()
    
    ' Set the Text properties of the ToolBarButton controls.
    toolBarButton1.Text = "Open"
    toolBarButton2.Text = "Save"
    toolBarButton3.Text = "Print"
    
    ' Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1)
    toolBar1.Buttons.Add(toolBarButton2)
    toolBar1.Buttons.Add(toolBarButton3)
    
    ' Add the ToolBar to the Form.
    Controls.Add(toolBar1)
End Sub

public void InitializeMyToolBar()
 {
    // Create and initialize the ToolBarButton controls and ToolBar.
    ToolBar toolBar1 = new ToolBar();
    ToolBarButton toolBarButton1 = new ToolBarButton();
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
 
    // Set the Text properties of the ToolBarButton controls.
    toolBarButton1.Text = "Open";
    toolBarButton2.Text = "Save";
    toolBarButton3.Text = "Print";
 
    // Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1);
    toolBar1.Buttons.Add(toolBarButton2);
    toolBar1.Buttons.Add(toolBarButton3);
 
    // Add the ToolBar to the Form.
    Controls.Add(toolBar1);
 }

public:
   void InitializeMyToolBar()
   {
      // Create and initialize the ToolBarButton controls and ToolBar.
      ToolBar^ toolBar1 = gcnew ToolBar;
      ToolBarButton^ toolBarButton1 = gcnew ToolBarButton;
      ToolBarButton^ toolBarButton2 = gcnew ToolBarButton;
      ToolBarButton^ toolBarButton3 = gcnew ToolBarButton;
      
      // Set the Text properties of the ToolBarButton controls.
      toolBarButton1->Text = "Open";
      toolBarButton2->Text = "Save";
      toolBarButton3->Text = "Print";
      
      // Add the ToolBarButton controls to the ToolBar.
      toolBar1->Buttons->Add( toolBarButton1 );
      toolBar1->Buttons->Add( toolBarButton2 );
      toolBar1->Buttons->Add( toolBarButton3 );
      
      // Add the ToolBar to the Form.
      Controls->Add( toolBar1 );
   }
public void InitializeMyToolBar()
{
    // Create and initialize the ToolBarButton controls and ToolBar.
    ToolBar toolBar1 = new ToolBar();
    ToolBarButton toolBarButton1 = new ToolBarButton();
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();

    // Set the Text properties of the ToolBarButton controls.
    toolBarButton1.set_Text("Open");
    toolBarButton2.set_Text("Save");
    toolBarButton3.set_Text("Print");

    // Add the ToolBarButton controls to the ToolBar.
    toolBar1.get_Buttons().Add(toolBarButton1);
    toolBar1.get_Buttons().Add(toolBarButton2);
    toolBar1.get_Buttons().Add(toolBarButton3);

    // Add the ToolBar to the Form.
    get_Controls().Add(toolBar1);
} //InitializeMyToolBar
継承階層継承階層
System.Object
  System.Windows.Forms.ToolBar.ToolBarButtonCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolBar.ToolBarButtonCollection メンバ
System.Windows.Forms 名前空間
ToolBar クラス
ToolBarButton

ToolBar.ToolBarButtonCollection コンストラクタ

ToolBar.ToolBarButtonCollection クラスの新しいインスタンスを初期化し、指定されたツール バーに割り当てます。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim owner As ToolBar

Dim instance As New ToolBarButtonCollection(owner)
public ToolBarButtonCollection (
    ToolBar owner
)
public:
ToolBarButtonCollection (
    ToolBar^ owner
)
public ToolBarButtonCollection (
    ToolBar owner
)
public function ToolBarButtonCollection (
    owner : ToolBar
)

パラメータ

owner

ToolBarButton コントロールのコレクションの親である ToolBar。

解説解説

通常は、ToolBar.ToolBarButtonCollection を作成して、そのコンストラクタを明示的に呼び出す必要はありません。ToolBar コントロールの Buttons プロパティを参照すると、ToolBar.ToolBarButtonCollection が作成されます。その後、オブジェクトのプロパティおよびメソッドにアクセス可能となり、コレクションに ToolBarButton コントロールを割り当てることができます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolBar.ToolBarButtonCollection クラス
ToolBar.ToolBarButtonCollection メンバ
System.Windows.Forms 名前空間
ToolBarButton

ToolBar.ToolBarButtonCollection プロパティ


パブリック プロパティパブリック プロパティ

明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.IList.Item 指定したインデックスにある項目を取得または設定します。
参照参照

関連項目

ToolBar.ToolBarButtonCollection クラス
System.Windows.Forms 名前空間
ToolBar クラス
ToolBarButton

ToolBar.ToolBarButtonCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add オーバーロードされます。 新しいツール バー ボタンをツール バー ボタン コレクションの末尾に追加します。
パブリック メソッド AddRange ツール バー ボタンのコレクションをこのツール バー ボタン コレクションに追加します。
パブリック メソッド Clear ツール バー ボタン コレクションからすべてのボタンを削除します。
パブリック メソッド Contains 指定したツール バー ボタンがコレクションのメンバかどうかを確認します。
パブリック メソッド ContainsKey 指定したキーの ToolBarButton がコレクション内にあるかどうかを判断します。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetEnumerator ツール バー ボタン コレクションを反復処理するために使用できる列挙子を返します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IndexOf コレクション内の指定したツール バー ボタンのインデックスを取得します。
パブリック メソッド IndexOfKey 指定したキーを持つ ToolBarButton が最初に出現するインデックスを取得します。
パブリック メソッド Insert ツール バー ボタン コレクション内の指定した位置に既存のツール バー ボタンを挿入します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド Remove ツール バー ボタン コレクションから指定したボタンを削除します。
パブリック メソッド RemoveAt ツール バー ボタン コレクションから指定したボタンを削除します。
パブリック メソッド RemoveByKey 指定したキーの ToolBarButton をコレクションから削除します。
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.CopyTo ICollection の要素を Array にコピーします。Array の特定のインデックスからコピーが開始されます。
インターフェイスの明示的な実装 System.Collections.IList.Add 指定されたツール バー ボタンをツール バー ボタン コレクションの末尾に追加します。
インターフェイスの明示的な実装 System.Collections.IList.Contains コレクションに特定の値が格納されているかどうかを判断します。
インターフェイスの明示的な実装 System.Collections.IList.IndexOf コレクション内での指定した項目のインデックスを調べます。
インターフェイスの明示的な実装 System.Collections.IList.Insert ツール バー ボタン コレクション内の指定した位置に既存のツール バー ボタンを挿入します。
インターフェイスの明示的な実装 System.Collections.IList.Remove 最初に出現する項目をコレクションから削除します。
参照参照

関連項目

ToolBar.ToolBarButtonCollection クラス
System.Windows.Forms 名前空間
ToolBar クラス
ToolBarButton

ToolBar.ToolBarButtonCollection メンバ

ToolBar クラスによって使用される ToolBarButton コントロールのコレクションをカプセル化します。

ToolBar.ToolBarButtonCollection データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ToolBar.ToolBarButtonCollection ToolBar.ToolBarButtonCollection クラスの新しいインスタンスを初期化し、指定されたツール バーに割り当てます。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add オーバーロードされます。 新しいツール バー ボタンをツール バー ボタン コレクションの末尾に追加します。
パブリック メソッド AddRange ツール バー ボタンのコレクションをこのツール バー ボタン コレクションに追加します。
パブリック メソッド Clear ツール バー ボタン コレクションからすべてのボタンを削除します。
パブリック メソッド Contains 指定したツール バー ボタンがコレクションのメンバかどうかを確認します。
パブリック メソッド ContainsKey 指定したキーの ToolBarButton がコレクション内にあるかどうかを判断します。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetEnumerator ツール バー ボタン コレクションを反復処理するために使用できる列挙子を返します。
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IndexOf コレクション内の指定したツール バー ボタンのインデックスを取得します。
パブリック メソッド IndexOfKey 指定したキーを持つ ToolBarButton が最初に出現するインデックスを取得します。
パブリック メソッド Insert ツール バー ボタン コレクション内の指定した位置に既存のツール バー ボタンを挿入します。
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド Remove ツール バー ボタン コレクションから指定したボタンを削除します。
パブリック メソッド RemoveAt ツール バー ボタン コレクションから指定したボタンを削除します。
パブリック メソッド RemoveByKey 指定したキーの ToolBarButton をコレクションから削除します。
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.CopyTo ICollection の要素を Array にコピーします。Array の特定のインデックスからコピーが開始されます。
インターフェイスの明示的な実装 System.Collections.IList.Add 指定されたツール バー ボタンをツール バー ボタン コレクションの末尾に追加します。
インターフェイスの明示的な実装 System.Collections.IList.Contains コレクションに特定の値が格納されているかどうかを判断します。
インターフェイスの明示的な実装 System.Collections.IList.IndexOf コレクション内での指定した項目のインデックスを調べます。
インターフェイスの明示的な実装 System.Collections.IList.Insert ツール バー ボタン コレクション内の指定した位置に既存のツール バー ボタンを挿入します。
インターフェイスの明示的な実装 System.Collections.IList.Remove 最初に出現する項目をコレクションから削除します。
インターフェイスの明示的な実装 System.Collections.IList.Item 指定したインデックスにある項目を取得または設定します。
参照参照

関連項目

ToolBar.ToolBarButtonCollection クラス
System.Windows.Forms 名前空間
ToolBar クラス
ToolBarButton



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「ToolBar.ToolBarButtonCollection」の関連用語

ToolBar.ToolBarButtonCollectionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ToolBar.ToolBarButtonCollectionのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS