Sdílet prostřednictvím


EventDescriptorCollection.Find(String, Boolean) Metoda

Definice

Získá popis události se zadaným názvem v kolekci.

public:
 virtual System::ComponentModel::EventDescriptor ^ Find(System::String ^ name, bool ignoreCase);
public virtual System.ComponentModel.EventDescriptor? Find(string name, bool ignoreCase);
public virtual System.ComponentModel.EventDescriptor Find(string name, bool ignoreCase);
abstract member Find : string * bool -> System.ComponentModel.EventDescriptor
override this.Find : string * bool -> System.ComponentModel.EventDescriptor
Public Overridable Function Find (name As String, ignoreCase As Boolean) As EventDescriptor

Parametry

name
String

Název události, která se má z kolekce získat.

ignoreCase
Boolean

truepokud chcete ignorovat případ události; v opačném případě . false

Návraty

Hodnota EventDescriptor se zadaným názvem nebo null pokud událost neexistuje.

Příklady

Následující příklad kódu najde konkrétní EventDescriptor. V textovém poli vytiskne typ komponenty EventDescriptor . Vyžaduje vytvoření button1 instance formuláře textBox1 .

private:
   void FindEvent()
   {
      // 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->Find( "Resize", false );
      
      // Prints the event name and event description.
      textBox1->Text = String::Concat( myEvent->Name, ": ", myEvent->Description );
   }
void FindEvent()
{
    // 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.Find("Resize", false);

    // Prints the event name and event description.
    textBox1.Text = myEvent.Name + ": " + myEvent.Description;
}
Private Sub FindEvent()
    ' 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.Find("Resize", False)
    
    ' Prints the event name and event description.
    textBox1.Text = myEvent.Name & ": " & myEvent.Description
End Sub

Poznámky

Poznámka:

Atribut HostProtectionAttribute použitý pro tuto třídu má následující Resources hodnotu vlastnosti: Synchronization. Nemá HostProtectionAttribute vliv na desktopové aplikace (které se obvykle spouští poklikáním na ikonu, zadáním příkazu nebo zadáním adresy URL v prohlížeči). Další informace naleznete v HostProtectionAttribute tématu třídy nebo programování SYSTÉMU SQL Server a atributy ochrany hostitele.

Platí pro

Viz také