ToolBarButtonClickEventArgs クラス
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


このイベントは、ユーザーが ToolBar コントロールのボタンをクリックすると必ず発生します。Button プロパティには、クリックされたボタンに関する情報を含む ToolBarButton が格納されています。

ToolBar と 3 つの ToolBarButton コントロールをインスタンス化する例を次に示します。ツール バー ボタンはボタン コレクションに割り当てられ、コレクションはツール バーに割り当てられ、ツール バーはフォームに追加されます。ツール バーの ButtonClick イベントが発生すると、ToolBarButtonClickEventArgs の Button プロパティが評価され、適切なダイアログが開きます。このコードは、Form、OpenFileDialog、SaveFileDialog、および PrintDialog がすべてインスタンス化されていることを前提にしています。
Public Sub InitializeMyToolBar() ' Create and initialize the ToolBar and ToolBarButton controls. 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 event-handler delegate. AddHandler toolBar1.ButtonClick, AddressOf Me.toolBar1_ButtonClick ' Add the ToolBar to the Form. Controls.Add(toolBar1) End Sub Private Sub toolBar1_ButtonClick(ByVal sender As Object, _ ByVal e As ToolBarButtonClickEventArgs) ' Evaluate the Button property to determine which button was clicked. Select Case toolBar1.Buttons.IndexOf(e.Button) Case 0 openFileDialog1.ShowDialog() ' Insert code to open the file. Case 1 saveFileDialog1.ShowDialog() ' Insert code to save the file. Case 2 printDialog1.ShowDialog() ' Insert code to print the file. End Select End Sub
public void InitializeMyToolBar() { // Create and initialize the ToolBar and ToolBarButton controls. 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 event-handler delegate. toolBar1.ButtonClick += new ToolBarButtonClickEventHandler ( this.toolBar1_ButtonClick); // Add the ToolBar to the Form. Controls.Add(toolBar1); } private void toolBar1_ButtonClick ( Object sender, ToolBarButtonClickEventArgs e) { // Evaluate the Button property to determine which button was clicked. switch(toolBar1.Buttons.IndexOf(e.Button)) { case 0: openFileDialog1.ShowDialog(); // Insert code to open the file. break; case 1: saveFileDialog1.ShowDialog(); // Insert code to save the file. break; case 2: printDialog1.ShowDialog(); // Insert code to print the file. break; } }
public: void InitializeMyToolBar() { // Create and initialize the ToolBar and ToolBarButton controls. 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 event-handler delegate. toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &Form1::toolBar1_ButtonClick ); // Add the ToolBar to the Form. Controls->Add( toolBar1 ); } private: void toolBar1_ButtonClick( Object^ sender, ToolBarButtonClickEventArgs^ e ) { // Evaluate the Button property to determine which button was clicked. switch ( toolBar1->Buttons->IndexOf( e->Button ) ) { case 0: openFileDialog1->ShowDialog(); // Insert code to open the file. break; case 1: saveFileDialog1->ShowDialog(); // Insert code to save the file. break; case 2: printDialog1->ShowDialog(); // Insert code to print the file. break; } }
public void InitializeMyToolBar() { // Create and initialize the ToolBar and ToolBarButton controls. 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 event-handler delegate. toolBar1.add_ButtonClick(new ToolBarButtonClickEventHandler( this.toolBar1_ButtonClick)); // Add the ToolBar to the Form. get_Controls().Add(toolBar1); } //InitializeMyToolBar protected void toolBar1_ButtonClick(Object sender, ToolBarButtonClickEventArgs e) { // Evaluate the Button property to determine which button was clicked. switch (toolBar1.get_Buttons().IndexOf(e.get_Button())) { case 0 : openFileDialog1.ShowDialog(); // Insert code to open the file. break; case 1 : saveFileDialog1.ShowDialog(); // Insert code to save the file. break; case 2 : printDialog1.ShowDialog(); // Insert code to print the file. break; } } //toolBar1_ButtonClick

System.EventArgs
System.Windows.Forms.ToolBarButtonClickEventArgs


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


ToolBarButtonClickEventArgs コンストラクタ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



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


ToolBarButtonClickEventArgs プロパティ
ToolBarButtonClickEventArgs メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

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



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からToolBarButtonClickEventArgsを検索する場合は、下記のリンクをクリックしてください。

- ToolBarButtonClickEventArgsのページへのリンク