EventDescriptorCollection.Find(String, Boolean) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene la descrizione dell'evento con il nome specificato nella raccolta.
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
Parametri
- name
- String
Nome dell'evento da ottenere dalla raccolta.
- ignoreCase
- Boolean
true se si desidera ignorare il caso dell'evento; in caso contrario, false.
Restituisce
Oggetto EventDescriptor con il nome specificato o null se l'evento non esiste.
Esempio
Nell'esempio di codice seguente viene trovato un oggetto specifico EventDescriptor. Stampa il tipo di componente in EventDescriptor una casella di testo. Richiede che button1 e textBox1 sia stata creata un'istanza in un modulo.
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
Commenti
Annotazioni
L'attributo HostProtectionAttribute applicato a questa classe ha il valore della proprietà seguente Resources : Synchronization. Non HostProtectionAttribute influisce sulle applicazioni desktop (che in genere vengono avviate facendo doppio clic su un'icona, digitando un comando o immettendo un URL in un browser). Per altre informazioni, vedere la HostProtectionAttribute classe o gli attributi di programmazione e protezione host di SQL Server.