ToolBar.ToolBarButtonCollection.AddRange メソッドとは? わかりやすく解説

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

ToolBar.ToolBarButtonCollection.AddRange メソッド

ツール バー ボタンコレクションをこのツール バー ボタン コレクション追加します

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

Public Sub AddRange ( _
    buttons As ToolBarButton() _
)
Dim instance As ToolBarButtonCollection
Dim buttons As ToolBarButton()

instance.AddRange(buttons)
public void AddRange (
    ToolBarButton[] buttons
)
public:
void AddRange (
    array<ToolBarButton^>^ buttons
)
public void AddRange (
    ToolBarButton[] buttons
)
public function AddRange (
    buttons : ToolBarButton[]
)

パラメータ

buttons

配列格納されているこの ToolBar.ToolBarButtonCollection を追加する ToolBarButton コントロールコレクション

解説解説
使用例使用例

存在する場合ToolBar コントロールか既存ToolBarButton削除しToolBar新し4 つToolBarButton オブジェクト追加して挿入するコード例次に示します。この例では、ToolBar コントロール配置されForm存在している必要があります

Private Sub AddToolbarButtons(toolBar As
 ToolBar)
   If Not toolBar.Buttons.IsReadOnly Then
      ' If toolBarButton1 in in the collection, remove it.
      If toolBar.Buttons.Contains(toolBarButton1) Then
         toolBar.Buttons.Remove(toolBarButton1)
      End If

      ' Create three toolbar buttons.
      Dim tbb1 As New ToolBarButton("tbb1")
      Dim tbb2 As New ToolBarButton("tbb2")
      Dim tbb3 As New ToolBarButton("tbb3")

      ' Add toolbar buttons to the toolbar.        
      toolBar.Buttons.AddRange(New ToolBarButton() {tbb2, tbb3})
      toolBar.Buttons.Add("tbb4")

      ' Insert tbb1 into the first position in the collection.
      toolBar.Buttons.Insert(0, tbb1)
   End If
End Sub
private void AddToolbarButtons(ToolBar toolBar)
{
   if(!toolBar.Buttons.IsReadOnly)
   {
      // If toolBarButton1 in in the collection, remove it.
      if(toolBar.Buttons.Contains(toolBarButton1))
      {
         toolBar.Buttons.Remove(toolBarButton1);
      }
    
      // Create three toolbar buttons.
      ToolBarButton tbb1 = new ToolBarButton("tbb1");
      ToolBarButton tbb2 = new ToolBarButton("tbb2");
      ToolBarButton tbb3 = new ToolBarButton("tbb3");
      
      // Add toolbar buttons to the toolbar.        
      toolBar.Buttons.AddRange(new ToolBarButton[] {tbb2, tbb3});
      toolBar.Buttons.Add("tbb4");
    
      // Insert tbb1 into the first position in the collection.
      toolBar.Buttons.Insert(0, tbb1);
   }
}
void AddToolbarButtons( ToolBar^ toolBar )
{
   if (  !toolBar->Buttons->IsReadOnly )
   {
      
      // If toolBarButton1 in in the collection, remove it.
      if ( toolBar->Buttons->Contains( toolBarButton1 )
 )
      {
         toolBar->Buttons->Remove( toolBarButton1 );
      }
      
      // Create three toolbar buttons.
      ToolBarButton^ tbb1 = gcnew ToolBarButton( "tbb1" );
      ToolBarButton^ tbb2 = gcnew ToolBarButton( "tbb2" );
      ToolBarButton^ tbb3 = gcnew ToolBarButton( "tbb3" );
      
      // Add toolbar buttons to the toolbar.
      array<ToolBarButton^>^buttons = {tbb2,tbb3};
      toolBar->Buttons->AddRange( buttons );
      toolBar->Buttons->Add( "tbb4" );
      
      // Insert tbb1 into the first position in the collection.
      toolBar->Buttons->Insert( 0, tbb1 );
   }
}
private void AddToolbarButtons(ToolBar toolBar)
{
    if (!(toolBar.get_Buttons().get_IsReadOnly())) {
        // If toolBarButton1 in in the collection, remove it.
        if (toolBar.get_Buttons().Contains(toolBarButton1)) {
            toolBar.get_Buttons().Remove(toolBarButton1);
        }
        // Create three toolbar buttons.
        ToolBarButton tbb1 = new ToolBarButton("tbb1");
        ToolBarButton tbb2 = new ToolBarButton("tbb2");
        ToolBarButton tbb3 = new ToolBarButton("tbb3");
        // Add toolbar buttons to the toolbar.        
        toolBar.get_Buttons().AddRange(new ToolBarButton[] { tbb2,
 tbb3 });
        toolBar.get_Buttons().Add("tbb4");
        // Insert tbb1 into the first position in the collection.
        toolBar.get_Buttons().Insert(0, tbb1);
    }
} //AddToolbarButtons
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolBar.ToolBarButtonCollection クラス
ToolBar.ToolBarButtonCollection メンバ
System.Windows.Forms 名前空間
Add
Clear



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

辞書ショートカット

すべての辞書の索引

ToolBar.ToolBarButtonCollection.AddRange メソッドのお隣キーワード
検索ランキング

   

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



ToolBar.ToolBarButtonCollection.AddRange メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS