ToolBar.ToolBarButtonCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
注意事項
ToolBar is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use ToolStrip instead.
ToolBarButton クラスで使用するToolBar コントロールのコレクションをカプセル化します。
public: ref class ToolBar::ToolBarButtonCollection : System::Collections::IList
public class ToolBar.ToolBarButtonCollection : System.Collections.IList
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`ToolBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `ToolStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public class ToolBar.ToolBarButtonCollection : System.Collections.IList
type ToolBar.ToolBarButtonCollection = class
interface IList
interface ICollection
interface IEnumerable
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`ToolBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `ToolStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type ToolBar.ToolBarButtonCollection = class
interface IList
interface ICollection
interface IEnumerable
Public Class ToolBar.ToolBarButtonCollection
Implements IList
- 継承
-
ToolBar.ToolBarButtonCollection
- 属性
- 実装
例
次のコード例では、 ToolBar コントロールと 3 つの ToolBarButton コントロールを作成して初期化します。 ツール バー ボタンがツール バーに割り当てられ、ツール バーがフォームに追加されます。 このコードでは、 Form が既に作成されている必要があります。
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.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 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
注釈
ToolBar.ToolBarButtonCollectionは、ツール バーに割り当てられているすべてのToolBar コントロールを保持するために、ToolBarButton クラスによって使用される 0 から始まるインデックス付きコレクションです。 Addメソッドを使用して個々のボタンを追加し、Removeメソッドを使用してボタンを削除します。 Clear メソッドを呼び出して、コレクションからすべてのボタンを削除します。
コンストラクター
| 名前 | 説明 |
|---|---|
| ToolBar.ToolBarButtonCollection(ToolBar) |
古い.
ToolBar.ToolBarButtonCollection クラスの新しいインスタンスを初期化し、指定したツール バーに割り当てます。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Count |
古い.
ツール バー ボタン コレクション内のボタンの数を取得します。 |
| IsReadOnly |
古い.
コレクションが読み取り専用かどうかを示す値を取得します。 |
| Item[Int32] |
古い.
ツール バー ボタン コレクション内の指定したインデックス位置にあるツール バー ボタンを取得または設定します。 |
| Item[String] |
古い.
指定したキーを持つ ToolBarButton をコレクションから取得します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Add(String) |
古い.
指定した Text プロパティ値を使用して、ツール バー ボタン コレクションの末尾に新しいツール バー ボタンを追加します。 |
| Add(ToolBarButton) |
古い.
指定したツール バー ボタンをツール バー ボタン コレクションの末尾に追加します。 |
| AddRange(ToolBarButton[]) |
古い.
ツール バー ボタンのコレクションをこのツール バー ボタン コレクションに追加します。 |
| Clear() |
古い.
ツール バー ボタン コレクションからすべてのボタンを削除します。 |
| Contains(ToolBarButton) |
古い.
指定したツール バー ボタンがコレクションのメンバーであるかどうかを判断します。 |
| ContainsKey(String) |
古い.
指定したキーを持つ ToolBarButton がコレクションに含まれているかどうかを判断します。 |
| Equals(Object) |
古い.
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetEnumerator() |
古い.
ツール バー ボタン コレクションを反復処理するために使用できる列挙子を返します。 |
| GetHashCode() |
古い.
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
古い.
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IndexOf(ToolBarButton) |
古い.
コレクション内の指定したツール バー ボタンのインデックスを取得します。 |
| IndexOfKey(String) |
古い.
指定したキーを持つ ToolBarButton が最初に出現するインデックスを取得します。 |
| Insert(Int32, ToolBarButton) |
古い.
ツール バー ボタン コレクション内の指定した場所に既存のツール バー ボタンを挿入します。 |
| MemberwiseClone() |
古い.
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| Remove(ToolBarButton) |
古い.
ツール バー ボタン コレクションから特定のボタンを削除します。 |
| RemoveAt(Int32) |
古い.
ツール バー ボタン コレクションから特定のボタンを削除します。 |
| RemoveByKey(String) |
古い.
指定したキーを持つ ToolBarButton をコレクションから削除します。 |
| ToString() |
古い.
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| ICollection.CopyTo(Array, Int32) |
古い.
特定のICollectionインデックスから始まるArrayの要素をArrayにコピーします。 |
| ICollection.IsSynchronized |
古い.
コレクションへのアクセスが同期されているかどうかを示す値を取得します (スレッド セーフ)。 |
| ICollection.SyncRoot |
古い.
ボタンのコレクションへのアクセスを同期するために使用できるオブジェクトを取得します。 |
| IList.Add(Object) |
古い.
指定したツール バー ボタンをツール バー ボタン コレクションの末尾に追加します。 |
| IList.Contains(Object) |
古い.
コレクションに特定の値が含まれているかどうかを判断します。 |
| IList.IndexOf(Object) |
古い.
コレクション内の特定の項目のインデックスを決定します。 |
| IList.Insert(Int32, Object) |
古い.
ツール バー ボタン コレクション内の指定した場所に既存のツール バー ボタンを挿入します。 |
| IList.IsFixedSize |
古い.
コレクションのサイズが固定されているかどうかを示す値を取得します。 |
| IList.Item[Int32] |
古い.
指定したインデックス位置にある項目を取得または設定します。 |
| IList.Remove(Object) |
古い.
コレクションから項目の最初の出現箇所を削除します。 |
拡張メソッド
| 名前 | 説明 |
|---|---|
| AsParallel(IEnumerable) |
古い.
クエリの並列化を有効にします。 |
| AsQueryable(IEnumerable) |
古い.
IEnumerable を IQueryableに変換します。 |
| Cast<TResult>(IEnumerable) |
古い.
IEnumerable の要素を指定した型にキャストします。 |
| OfType<TResult>(IEnumerable) |
古い.
指定した型に基づいて、IEnumerable の要素をフィルター処理します。 |