EventDescriptorCollection.Find(String, Boolean) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe a descrição do evento com o nome especificado na coleção.
public:
virtual System::ComponentModel::EventDescriptor ^ Find(System::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
Parâmetros
- name
- String
O nome do evento para obter da coleção.
- ignoreCase
- Boolean
true Se quiseres ignorar o caso do evento; caso contrário, false.
Devoluções
Com EventDescriptor o nome especificado, ou null se o evento não existir.
Exemplos
O seguinte exemplo de código encontra um .EventDescriptor Imprime o tipo de componente para isto EventDescriptor numa caixa de texto. Requer isso button1 e textBox1 ter sido instanciado num formulário.
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
Observações
Note
O HostProtectionAttribute atributo aplicado a esta classe tem o seguinte Resources valor de propriedade: Synchronization. Isto HostProtectionAttribute não afeta aplicações de ambiente de trabalho (que normalmente são iniciadas com duplo clique num ícone, digitação de um comando ou introdução de um URL no navegador). Para mais informações, consulte a classe HostProtectionAttribute ou SQL Server Atributos de Programação e Proteção de Host.