ToolBar.Buttons プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

[LocalizableAttribute(true)] public: property ToolBarButtonCollection^ Buttons { ToolBarButtonCollection^ get (); }
ToolBarButton コントロールのコレクションを格納している ToolBar.ToolBarButtonCollection。

Buttons プロパティは、ツール バーに割り当てられたすべての ToolBarButton コントロールを格納するために使用される、0 から始まるインデックス番号が付いたコレクションです。このプロパティは読み取り専用であるため、ツール バー ボタンのコレクションを直接割り当てることはできません。ツール バー ボタンは、ToolBar.ToolBarButtonCollection クラスから継承したメソッドを使用して追加または削除できます。ボタンを個別に追加する場合は Add メソッドを使用し、ボタンを削除する場合は Remove メソッドを使用します。コレクションからすべてのボタンを削除するには、Clear メソッドを呼び出します。

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

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からToolBar.Buttons プロパティを検索する場合は、下記のリンクをクリックしてください。

- ToolBar.Buttons プロパティのページへのリンク