다음을 통해 공유


EventDescriptorCollection.Item[] 속성

정의

지정된 이벤트를 가져옵니다.

오버로드

Name Description
Item[Int32]

지정된 인덱스 번호가 있는 이벤트를 가져오거나 설정합니다.

Item[String]

지정된 이름을 가진 이벤트를 가져오거나 설정합니다.

Item[Int32]

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

지정된 인덱스 번호가 있는 이벤트를 가져오거나 설정합니다.

public:
 virtual property System::ComponentModel::EventDescriptor ^ default[int] { System::ComponentModel::EventDescriptor ^ get(int index); };
public virtual System.ComponentModel.EventDescriptor? this[int index] { get; }
public virtual System.ComponentModel.EventDescriptor this[int index] { get; }
member this.Item(int) : System.ComponentModel.EventDescriptor
Default Public Overridable ReadOnly Property Item(index As Integer) As EventDescriptor

매개 변수

index
Int32

가져올 또는 설정할 인덱스 번호( EventDescriptor 0부터 시작)입니다.

속성 값

EventDescriptor 지정된 인덱스 번호가 있는 값입니다.

예외

index가 유효한 인덱스가 아닌 경우 Item[Int32]

예제

다음 코드 예제에서는 속성을 사용 하 여 Item[] 텍스트 상자에 인덱스 번호로 지정 된 이름을 EventDescriptor 인쇄 합니다. 인덱스 번호는 0부터 시작하는 예제이므로 두 번째 EventDescriptor인덱스의 이름을 인쇄합니다. 이를 요구 button1 하며 textBox1 양식에서 인스턴스화되었습니다.

private:
   void PrintIndexItem()
   {
      
      // Creates a new collection and assigns it the events for button1.
      EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
      
      // Prints the second event's name.
      textBox1->Text = events[ 1 ]->ToString();
   }
private void PrintIndexItem() {
    // Creates a new collection and assigns it the events for button1.
    EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);
 
    // Prints the second event's name.
    textBox1.Text = events[1].ToString();
 }
Private Sub PrintIndexItem()
    ' Creates a new collection and assigns it the events for button1.
    Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
    
    ' Prints the second event's name.
    textBox1.Text = events(1).ToString()
End Sub

설명

인덱스 번호는 0부터 시작하는 값입니다. 따라서 해당 위치에 액세스EventDescriptor하려면 특정 EventDescriptor 위치의 숫자 위치에서 1을 빼야 합니다. 예를 들어 세 번째 EventDescriptor항목을 얻으려면 .를 지정 myColl[2]해야 합니다.

추가 정보

적용 대상

Item[String]

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

지정된 이름을 가진 이벤트를 가져오거나 설정합니다.

public:
 virtual property System::ComponentModel::EventDescriptor ^ default[System::String ^] { System::ComponentModel::EventDescriptor ^ get(System::String ^ name); };
public virtual System.ComponentModel.EventDescriptor this[string name] { get; }
member this.Item(string) : System.ComponentModel.EventDescriptor
Default Public Overridable ReadOnly Property Item(name As String) As EventDescriptor

매개 변수

name
String

가져올 이름 또는 설정할 이름 EventDescriptor 입니다.

속성 값

EventDescriptor 지정된 이름의 이름 또는 null 이벤트가 없는 경우입니다.

예제

다음 코드 예제에서는 인덱스 Item[] 로 지정 된 구성 요소의 형식을 EventDescriptor 인쇄 하는 속성을 사용 합니다. 이를 요구 button1 하며 textBox1 양식에서 인스턴스화되었습니다.

private:
   void PrintIndexItem2()
   {
      
      // Creates a new collection and assigns it the events for button1.
      EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
      
      // Sets an EventDescriptor to the specific event.
      EventDescriptor^ myEvent = events[ "KeyDown" ];
      
      // Prints the name of the event.
      textBox1->Text = myEvent->Name;
   }
private void PrintIndexItem2() {
    // Creates a new collection and assigns it the events for button1.
    EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);
 
    // Sets an EventDescriptor to the specific event.
    EventDescriptor myEvent = events["KeyDown"];
 
    // Prints the name of the event.
    textBox1.Text = myEvent.Name;
 }
Private Sub PrintIndexItem2()
    ' Creates a new collection and assigns it the events for button1.
    Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
    
    ' Sets an EventDescriptor to the specific event.
    Dim myEvent As EventDescriptor = events("KeyDown")
    
    ' Prints the name of the event.
    textBox1.Text = myEvent.Name
End Sub

설명

Item[] 이 속성은 이름을 검색할 때 대/소문자를 구분합니다. 즉, 이름 "에나메"와 "에나메"는 두 개의 서로 다른 이벤트로 간주됩니다.

메모

이 클래스에 적용된 특성에는 HostProtectionAttribute 다음과 같은 Resources 속성 값 Synchronization이 있습니다. 데스크톱 애플리케이션에는 HostProtectionAttribute 영향을 주지 않습니다(일반적으로 아이콘을 두 번 클릭하거나 명령을 입력하거나 브라우저에서 URL을 입력하여 시작됨). 자세한 내용은 클래스 또는 SQL Server 프로그래밍 및 호스트 보호 특성을 참조 HostProtectionAttribute 하세요.

추가 정보

적용 대상