다음을 통해 공유


ToolBar.ToolBarButtonCollection.Item[] 속성

정의

컬렉션 내에서 a를 ToolBarButton 가져오거나 설정합니다.

오버로드

Name Description
Item[String]

ToolBarButton 컬렉션에서 지정된 키를 사용하여 가져옵니다.

Item[Int32]

도구 모음 단추 컬렉션의 지정된 인덱싱된 위치에 있는 도구 모음 단추를 가져오거나 설정합니다.

Item[String]

Source:
ToolBar.ToolBarButtonCollection.cs
Source:
ToolBar.ToolBarButtonCollection.cs

ToolBarButton 컬렉션에서 지정된 키를 사용하여 가져옵니다.

public:
 virtual property System::Windows::Forms::ToolBarButton ^ default[System::String ^] { System::Windows::Forms::ToolBarButton ^ get(System::String ^ key); };
public virtual System.Windows.Forms.ToolBarButton this[string key] { get; }
member this.Item(string) : System.Windows.Forms.ToolBarButton
Default Public Overridable ReadOnly Property Item(key As String) As ToolBarButton

매개 변수

key
String

검색할 이름입니다 ToolBarButton .

속성 값

해당 Name 속성이 ToolBarButton 지정된 키와 일치하는 경우

설명

속성은 Name 에 있는 키에 ToolBarButtonToolBar.ToolBarButtonCollection해당합니다.

키 비교는 대/소문자를 구분하지 않습니다. 매개 변수 또는 key 빈 문자열 Item[]nullnull 경우 .

적용 대상

Item[Int32]

Source:
ToolBar.ToolBarButtonCollection.cs
Source:
ToolBar.ToolBarButtonCollection.cs

도구 모음 단추 컬렉션의 지정된 인덱싱된 위치에 있는 도구 모음 단추를 가져오거나 설정합니다.

public:
 virtual property System::Windows::Forms::ToolBarButton ^ default[int] { System::Windows::Forms::ToolBarButton ^ get(int index); void set(int index, System::Windows::Forms::ToolBarButton ^ value); };
public virtual System.Windows.Forms.ToolBarButton this[int index] { get; set; }
member this.Item(int) : System.Windows.Forms.ToolBarButton with get, set
Default Public Overridable Property Item(index As Integer) As ToolBarButton

매개 변수

index
Int32

컬렉션에서 인덱싱된 위치 ToolBarButton 입니다.

속성 값

ToolBarButton 지정된 인덱싱된 위치의 도구 모음 단추를 나타내는 A입니다.

예외

index 값은 null.

index 값이 0보다 작습니다.

-또는-

값이 index 컬렉션의 단추 수보다 크며 단추 컬렉션은 그렇지 않습니다 null.

예제

다음 코드 예제에서는 도구 모음의 마지막 도구 모음 단추를 바꿉니다. 이 코드를 사용하려면 하나 ToolBar 이상의 ToolBarButton 코드가 생성되어야 합니다. 이 예제에서는 도구 모음의 단추 수를 가져오고 마지막 단추를 새로 만든 단추로 바꿉니다. index 대체되는 도구 모음 단추의 값은 컬렉션이 0부터 시작하는 인덱스이므로 속성에서 ToolBarButton 1을 뺀 값으로 설정 Count 됩니다.

void ReplaceMyToolBarButton()
{
   int btns;
   btns = toolBar1->Buttons->Count;
   ToolBarButton^ toolBarButton1 = gcnew ToolBarButton;
   toolBarButton1->Text = "myButton";
   
   // Replace the last ToolBarButton in the collection.
   toolBar1->Buttons[ btns - 1 ] = toolBarButton1;
}
public void ReplaceMyToolBarButton()
 {
    int btns;
    btns = toolBar1.Buttons.Count;
    ToolBarButton toolBarButton1 = new ToolBarButton();
    toolBarButton1.Text = "myButton";
 
    // Replace the last ToolBarButton in the collection.
    toolBar1.Buttons[btns - 1] = toolBarButton1;
 }
Public Sub ReplaceMyToolBarButton()
    Dim btns As Integer
    btns = toolBar1.Buttons.Count
    Dim toolBarButton1 As New ToolBarButton()
    toolBarButton1.Text = "myButton"
    
    ' Replace the last ToolBarButton in the collection.
    toolBar1.Buttons(btns - 1) = toolBarButton1
End Sub

설명

컨트롤을 특정 위치에 할당 ToolBarButton 하거나 해당 위치에서 검색 ToolBar.ToolBarButtonCollection하려면 특정 인덱스 값을 사용하여 컬렉션 개체를 참조할 수 있습니다. 인덱스 ToolBar.ToolBarButtonCollection 값은 0부터 시작하는 인덱스입니다.

추가 정보

적용 대상