Cet article a fait l’objet d’une traduction automatique. Pour afficher l’article en anglais, activez la case d’option Anglais. Vous pouvez également afficher le texte anglais dans une fenêtre contextuelle en faisant glisser le pointeur de la souris sur le texte traduit.
Traduction
Anglais

Control.HandleDestroyed événement

 

Date de publication : novembre 2016

Se produit pendant le processus de destruction du handle du contrôle.

Espace de noms:   System.Windows.Forms
Assembly:  System.Windows.Forms (dans System.Windows.Forms.dll)

[BrowsableAttribute(false)]
public event EventHandler HandleDestroyed

During the E:System.Windows.Forms.Control.HandleDestroyed event, the control is still a valid Windows control and the P:System.Windows.Forms.Control.Handle can be recreated by calling the M:System.Windows.Forms.Control.RecreateHandle method.

For more information about handling events, see Handling and Raising Events.

The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the E:System.Windows.Forms.Control.HandleDestroyed event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Overload:System.Windows.Forms.MessageBox.Show with Overload:System.Console.WriteLine or appending the message to a multiline T:System.Windows.Forms.TextBox.

To run the example code, paste it into a project that contains an instance of a type that inherits from T:System.Windows.Forms.Control, such as a T:System.Windows.Forms.Button or T:System.Windows.Forms.ComboBox. Then name the instance Control1 and ensure that the event handler is associated with the E:System.Windows.Forms.Control.HandleDestroyed event.

private void Control1_HandleDestroyed(Object sender, EventArgs e) {

   MessageBox.Show("You are in the Control.HandleDestroyed event.");

}

.NET Framework
Disponible depuis 1.1
Retour au début
Afficher: