Expandir Minimizar
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original
Este tópico ainda não foi avaliado como - Avalie este tópico

RefreshEventHandler Representante

Represents the method that handles the Refreshed event raised when a Type or component is changed during design time.

Namespace:  System.ComponentModel
Assembly:  System (em System. dll)
[HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)]
public delegate void RefreshEventHandler(
	RefreshEventArgs e
)

Parâmetros

e
Tipo: System.ComponentModel.RefreshEventArgs
A RefreshEventArgs that contains the component or Type that changed.
ObservaçãoObservação:

O atributo HostProtectionAttribute aplicado a esse tipo ou membro tem o seguinte Resources valor da propriedade: SharedState. O HostProtectionAttribute não afeta área de trabalho aplicativos (que são geralmente iniciado por duas vezes em um ícone, digitando um comando ou inserindo um URL em um navegador). Para obter mais informações, consulte a classe HostProtectionAttribute ou Programação SQL Servidor e atributos de proteção de host.

When you create a RefreshEventHandler delegate, you identify the method that will handle the event.Para associar o evento com o manipulador de eventos, adicione uma instância do delegate ao evento.O manipulador de evento é chamado sempre que o evento ocorre, a menos que você remova o delegate.For more information about event handler delegates, see Eventos e representantes.

The following sample demonstrates how to use a RefreshEventHandler delegate to handle the Refreshed event when a type or component changes.In the code, the OnRefreshed event handles the event and displays the component being changed.

The code assumes that a TextBox control is already sited on the form.

private void Form1_Load(object sender, System.EventArgs e)
{
    textBox1.Text = "changed";
    System.ComponentModel.TypeDescriptor.Refreshed += new
    System.ComponentModel.RefreshEventHandler(OnRefresh);
    System.ComponentModel.TypeDescriptor.GetProperties(textBox1);
    System.ComponentModel.TypeDescriptor.Refresh(textBox1);
}

protected static void OnRefresh(System.ComponentModel.RefreshEventArgs e)
{
    Console.WriteLine(e.ComponentChanged.ToString());
}


private void Form1_Load(Object sender, System.EventArgs e)
{
    textBox1.set_Text("changed");
    System.ComponentModel.TypeDescriptor.add_Refreshed(
        new System.ComponentModel.RefreshEventHandler(OnRefresh));
    System.ComponentModel.TypeDescriptor.GetProperties(textBox1);
    System.ComponentModel.TypeDescriptor.Refresh(textBox1);
} //Form1_Load

protected static void OnRefresh(System.ComponentModel.RefreshEventArgs e)
{
    Console.WriteLine(e.get_ComponentChanged().ToString());
} //OnRefresh


Isso foi útil para você?
(1500 caracteres restantes)

Contribuições da comunidade

ADICIONAR
© 2013 Microsoft. Todos os direitos reservados.