ToolStripDropDown.Closed ToolStripDropDown.Closed ToolStripDropDown.Closed ToolStripDropDown.Closed Event

Definición

Se produce cuando el ToolStripDropDown está cerrado.Occurs when the ToolStripDropDown is closed.

public:
 event System::Windows::Forms::ToolStripDropDownClosedEventHandler ^ Closed;
public event System.Windows.Forms.ToolStripDropDownClosedEventHandler Closed;
member this.Closed : System.Windows.Forms.ToolStripDropDownClosedEventHandler 
Public Custom Event Closed As ToolStripDropDownClosedEventHandler 

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este miembro.The following code example demonstrates the use of this member. En el ejemplo, un controlador de eventos informa sobre la aparición de la Closed eventos.In the example, an event handler reports on the occurrence of the Closed event. Este informe le ayuda a saber cuándo el evento se produce y puede ayudarle a depurar.This report helps you to learn when the event occurs and can assist you in debugging. Para informar sobre varios eventos o en eventos que se producen con frecuencia, considere reemplazar MessageBox.Show con Console.WriteLine o agregar el mensaje a un multilínea TextBox.To report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

Para ejecutar el ejemplo de código, péguelo en un proyecto que contiene una instancia del tipo ToolStripDropDown denominado ToolStripDropDown1.To run the example code, paste it into a project that contains an instance of type ToolStripDropDown named ToolStripDropDown1. A continuación, asegúrese de que está asociado el controlador de eventos con el Closed eventos.Then ensure that the event handler is associated with the Closed event.

private void ToolStripDropDown1_Closed(Object sender, ToolStripDropDownClosedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Closed Event" );
}
Private Sub ToolStripDropDown1_Closed(sender as Object, e as ToolStripDropDownClosedEventArgs) _ 
     Handles ToolStripDropDown1.Closed

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Closed Event")

End Sub

Comentarios

Cuando se crea un delegado ToolStripDropDown, se identifica el método que controlará el evento.When you create a ToolStripDropDown delegate, you identify the method that will handle the event. Para asociar el evento al controlador, se debe agregar una instancia del delegado al evento.To associate the event with your event handler, add an instance of the delegate to the event. Siempre que se produce el evento, se llama a su controlador, a menos que se quite el delegado.The event handler is called whenever the event occurs, unless you remove the delegate. Para obtener más información sobre los delegados de controlador de eventos, consulte controlar y provocar eventos.For more information about event-handler delegates, see Handling and Raising Events.

Se aplica a