Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Delegado ComponentChangedEventHandler

 

Publicado: octubre de 2016

Representa el método que procesará un evento ComponentChanged.

Espacio de nombres:   System.ComponentModel.Design
Ensamblado:  System (en System.dll)

[ComVisibleAttribute(true)]
[HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)]
public delegate void ComponentChangedEventHandler(
	object sender,
	ComponentChangedEventArgs e
)

Parámetros

sender
Type: System.Object

Origen del evento.

e
Type: System.ComponentModel.Design.ComponentChangedEventArgs

Objeto ComponentChangedEventArgs que contiene los datos del evento.

When you create a T:System.ComponentModel.Design.ComponentChangedEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see NIB: Events and Delegates.

A E:System.ComponentModel.Design.IComponentChangeService.ComponentChanged event will not occur during the loading or unloading of a form because changes are expected during these operations.

This example demonstrates registering a T:System.ComponentModel.Design.ComponentChangedEventHandler and handling the E:System.ComponentModel.Design.IComponentChangeService.ComponentChanged event.

public void LinkComponentChangedEvent(IComponentChangeService changeService)
{
    // Registers an event handler for the ComponentChanged event.
    changeService.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);            
}

private void OnComponentChanged(object sender, ComponentChangedEventArgs e)
{
    // Displays changed component information on the console.
    Console.WriteLine("Type of the component that has changed: "+e.Component.GetType().FullName);      
    Console.WriteLine("Name of the member of the component that has changed: "+e.Member.Name);            
    Console.WriteLine("Old value of the member: "+e.OldValue.ToString());
    Console.WriteLine("New value of the member: "+e.NewValue.ToString());
}

.NET Framework
Disponible desde 1.1
Volver al principio
Mostrar: