ToolBarButton コンストラクタとは? わかりやすく解説

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

ToolBarButton コンストラクタ


ToolBarButton コンストラクタ (String)

ToolBarButton クラス新しインスタンス初期化し割り当てられテキストボタン上に表示します

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

public ToolBarButton (
    string text
)
public:
ToolBarButton (
    String^ text
)
public ToolBarButton (
    String text
)
public function ToolBarButton (
    text : String
)

パラメータ

text

新しい ToolBarButton に表示されるテキスト

解説解説
使用例使用例

ToolBar3 つの ToolBarButton コントロール作成しボタンツール バー割り当ててから、ボタンの共通プロパティ一部設定するコード例次に示します。このコードは、MenuItem、ImageListToolTip、および Form作成されていることと、ImageList少なくとも 1 つImage割り当てられていることを前提にしています。

Public Sub InitializeMyToolBar()
    ' Create the ToolBar, ToolBarButton controls, and menus.
    Dim toolBarButton1 As New
 ToolBarButton("Open")
    Dim toolBarButton2 As New
 ToolBarButton()
    Dim toolBarButton3 As New
 ToolBarButton()
    Dim toolBar1 As New
 ToolBar()
Dim menuItem1 As New MenuItem("Print")
Dim contextMenu1 As New
 ContextMenu(New MenuItem(){menuItem1})
    
    ' Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1)
    toolBar1.Buttons.Add(toolBarButton2)
    toolBar1.Buttons.Add(toolBarButton3)
    
    ' Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.ImageList = imageList1
    toolBar1.ShowToolTips = True
    
    ' Assign ImageIndex, ContextMenu, Text, ToolTip, and
    ' Style properties of the ToolBarButton controls. 
    toolBarButton2.Style = ToolBarButtonStyle.Separator
    toolBarButton3.Text = "Print"
    toolBarButton3.Style = ToolBarButtonStyle.DropDownButton
    toolBarButton3.ToolTipText = "Print"
    toolBarButton3.ImageIndex = 0
    toolBarButton3.DropDownMenu = contextMenu1
    
    ' Add the ToolBar to a form.
    Controls.Add(toolBar1)
End Sub

public void InitializeMyToolBar()
 {
    // Create the ToolBar, ToolBarButton controls, and menus.
    ToolBarButton toolBarButton1 = new ToolBarButton("Open");
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
    ToolBar toolBar1 = new ToolBar();
    MenuItem menuItem1 = new MenuItem("Print");
    ContextMenu contextMenu1 = new ContextMenu(new
 MenuItem[]{menuItem1});

     
    // Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1);
    toolBar1.Buttons.Add(toolBarButton2);
    toolBar1.Buttons.Add(toolBarButton3);
 
    // Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.ImageList = imageList1;
    toolBar1.ShowToolTips = true;
 
    /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
       Style properties of the ToolBarButton controls. */
    toolBarButton2.Style = ToolBarButtonStyle.Separator;
    toolBarButton3.Text = "Print";
    toolBarButton3.Style = ToolBarButtonStyle.DropDownButton;
    toolBarButton3.ToolTipText = "Print";
    toolBarButton3.ImageIndex = 0;
    toolBarButton3.DropDownMenu = contextMenu1;
 
    // Add the ToolBar to a form.
    Controls.Add(toolBar1);
 }
 
public:
   void InitializeMyToolBar()
   {
      // Create the ToolBar, ToolBarButton controls, and menus.
      ToolBarButton^ toolBarButton1 = gcnew ToolBarButton( "Open" );
      ToolBarButton^ toolBarButton2 = gcnew ToolBarButton;
      ToolBarButton^ toolBarButton3 = gcnew ToolBarButton;
      ToolBar^ toolBar1 = gcnew ToolBar;
      MenuItem^ menuItem1 = gcnew MenuItem( "Print" );
      array<MenuItem^>^ temp1 = {menuItem1};
      System::Windows::Forms::ContextMenu^ contextMenu1 =
         gcnew System::Windows::Forms::ContextMenu( temp1 );
      
      // Add the ToolBarButton controls to the ToolBar.
      toolBar1->Buttons->Add( toolBarButton1 );
      toolBar1->Buttons->Add( toolBarButton2 );
      toolBar1->Buttons->Add( toolBarButton3 );
      
      // Assign an ImageList to the ToolBar and show ToolTips.
      toolBar1->ImageList = imageList1;
      toolBar1->ShowToolTips = true;
      
      /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
         Style properties of the ToolBarButton controls. */
      toolBarButton2->Style = ToolBarButtonStyle::Separator;
      toolBarButton3->Text = "Print";
      toolBarButton3->Style = ToolBarButtonStyle::DropDownButton;
      toolBarButton3->ToolTipText = "Print";
      toolBarButton3->ImageIndex = 0;
      toolBarButton3->DropDownMenu = contextMenu1;
      
      // Add the ToolBar to a form.
      Controls->Add( toolBar1 );
   }
public void InitializeMyToolBar()
{
    // Create the ToolBar, ToolBarButton controls, and menus.
    ToolBarButton toolBarButton1 = new ToolBarButton("Open");
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
    ToolBar toolBar1 = new ToolBar();
    MenuItem menuItem1 = new MenuItem("Print");
    ContextMenu contextMenu1 = new ContextMenu(new
 MenuItem[] {menuItem1});

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

    // Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.set_ImageList(imageList1);
    toolBar1.set_ShowToolTips(true);

    /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
     * Style properties of the ToolBarButton controls. 
     */
    toolBarButton2.set_Style(ToolBarButtonStyle.Separator);
    toolBarButton3.set_Text("Print");
    toolBarButton3.set_Style(ToolBarButtonStyle.DropDownButton);
    toolBarButton3.set_ToolTipText("Print");
    toolBarButton3.set_ImageIndex(0);
    toolBarButton3.set_DropDownMenu(contextMenu1);

    // Add the ToolBar to a form.
    get_Controls().Add(toolBar1);
} //InitializeMyToolBar
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ToolBarButton コンストラクタ ()

ToolBarButton クラス新しインスタンス初期化します。

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

public ToolBarButton ()
public:
ToolBarButton ()
public ToolBarButton ()
public function ToolBarButton ()
解説解説

新しく作成されToolBarButton には、既定Text または Image割り当てられていません。ボタン既定スタイルToolBarButtonStyle.PushButton です。

使用例使用例

ToolBar3 つの ToolBarButton コントロール作成しボタンツール バー割り当ててから、ボタンの共通プロパティ一部設定するコード例次に示します。このコードは、MenuItem、ImageListToolTip、および Form作成されていることと、ImageList少なくとも 1 つImage割り当てられていることを前提にしています。

Public Sub InitializeMyToolBar()
    ' Create the ToolBar, ToolBarButton controls, and menus.
    Dim toolBarButton1 As New
 ToolBarButton("Open")
    Dim toolBarButton2 As New
 ToolBarButton()
    Dim toolBarButton3 As New
 ToolBarButton()
    Dim toolBar1 As New
 ToolBar()
Dim menuItem1 As New MenuItem("Print")
Dim contextMenu1 As New
 ContextMenu(New MenuItem(){menuItem1})
    
    ' Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1)
    toolBar1.Buttons.Add(toolBarButton2)
    toolBar1.Buttons.Add(toolBarButton3)
    
    ' Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.ImageList = imageList1
    toolBar1.ShowToolTips = True
    
    ' Assign ImageIndex, ContextMenu, Text, ToolTip, and
    ' Style properties of the ToolBarButton controls. 
    toolBarButton2.Style = ToolBarButtonStyle.Separator
    toolBarButton3.Text = "Print"
    toolBarButton3.Style = ToolBarButtonStyle.DropDownButton
    toolBarButton3.ToolTipText = "Print"
    toolBarButton3.ImageIndex = 0
    toolBarButton3.DropDownMenu = contextMenu1
    
    ' Add the ToolBar to a form.
    Controls.Add(toolBar1)
End Sub

public void InitializeMyToolBar()
 {
    // Create the ToolBar, ToolBarButton controls, and menus.
    ToolBarButton toolBarButton1 = new ToolBarButton("Open");
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
    ToolBar toolBar1 = new ToolBar();
    MenuItem menuItem1 = new MenuItem("Print");
    ContextMenu contextMenu1 = new ContextMenu(new
 MenuItem[]{menuItem1});

     
    // Add the ToolBarButton controls to the ToolBar.
    toolBar1.Buttons.Add(toolBarButton1);
    toolBar1.Buttons.Add(toolBarButton2);
    toolBar1.Buttons.Add(toolBarButton3);
 
    // Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.ImageList = imageList1;
    toolBar1.ShowToolTips = true;
 
    /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
       Style properties of the ToolBarButton controls. */
    toolBarButton2.Style = ToolBarButtonStyle.Separator;
    toolBarButton3.Text = "Print";
    toolBarButton3.Style = ToolBarButtonStyle.DropDownButton;
    toolBarButton3.ToolTipText = "Print";
    toolBarButton3.ImageIndex = 0;
    toolBarButton3.DropDownMenu = contextMenu1;
 
    // Add the ToolBar to a form.
    Controls.Add(toolBar1);
 }
 
public:
   void InitializeMyToolBar()
   {
      // Create the ToolBar, ToolBarButton controls, and menus.
      ToolBarButton^ toolBarButton1 = gcnew ToolBarButton( "Open" );
      ToolBarButton^ toolBarButton2 = gcnew ToolBarButton;
      ToolBarButton^ toolBarButton3 = gcnew ToolBarButton;
      ToolBar^ toolBar1 = gcnew ToolBar;
      MenuItem^ menuItem1 = gcnew MenuItem( "Print" );
      array<MenuItem^>^ temp1 = {menuItem1};
      System::Windows::Forms::ContextMenu^ contextMenu1 =
         gcnew System::Windows::Forms::ContextMenu( temp1 );
      
      // Add the ToolBarButton controls to the ToolBar.
      toolBar1->Buttons->Add( toolBarButton1 );
      toolBar1->Buttons->Add( toolBarButton2 );
      toolBar1->Buttons->Add( toolBarButton3 );
      
      // Assign an ImageList to the ToolBar and show ToolTips.
      toolBar1->ImageList = imageList1;
      toolBar1->ShowToolTips = true;
      
      /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
         Style properties of the ToolBarButton controls. */
      toolBarButton2->Style = ToolBarButtonStyle::Separator;
      toolBarButton3->Text = "Print";
      toolBarButton3->Style = ToolBarButtonStyle::DropDownButton;
      toolBarButton3->ToolTipText = "Print";
      toolBarButton3->ImageIndex = 0;
      toolBarButton3->DropDownMenu = contextMenu1;
      
      // Add the ToolBar to a form.
      Controls->Add( toolBar1 );
   }
public void InitializeMyToolBar()
{
    // Create the ToolBar, ToolBarButton controls, and menus.
    ToolBarButton toolBarButton1 = new ToolBarButton("Open");
    ToolBarButton toolBarButton2 = new ToolBarButton();
    ToolBarButton toolBarButton3 = new ToolBarButton();
    ToolBar toolBar1 = new ToolBar();
    MenuItem menuItem1 = new MenuItem("Print");
    ContextMenu contextMenu1 = new ContextMenu(new
 MenuItem[] {menuItem1});

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

    // Assign an ImageList to the ToolBar and show ToolTips.
    toolBar1.set_ImageList(imageList1);
    toolBar1.set_ShowToolTips(true);

    /* Assign ImageIndex, ContextMenu, Text, ToolTip, and 
     * Style properties of the ToolBarButton controls. 
     */
    toolBarButton2.set_Style(ToolBarButtonStyle.Separator);
    toolBarButton3.set_Text("Print");
    toolBarButton3.set_Style(ToolBarButtonStyle.DropDownButton);
    toolBarButton3.set_ToolTipText("Print");
    toolBarButton3.set_ImageIndex(0);
    toolBarButton3.set_DropDownMenu(contextMenu1);

    // Add the ToolBar to a form.
    get_Controls().Add(toolBar1);
} //InitializeMyToolBar
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からToolBarButton コンストラクタを検索した結果を表示しています。
Weblioに収録されているすべての辞書からToolBarButton コンストラクタを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からToolBarButton コンストラクタを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ToolBarButton コンストラクタ」の関連用語

ToolBarButton コンストラクタのお隣キーワード
検索ランキング

   

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



ToolBarButton コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS