ToolStripItem.MouseUp ToolStripItem.MouseUp ToolStripItem.MouseUp ToolStripItem.MouseUp Event

Definición

Se produce cuando el puntero del mouse está sobre el elemento y se suelta un botón del mouse.Occurs when the mouse pointer is over the item and a mouse button is released.

public:
 event System::Windows::Forms::MouseEventHandler ^ MouseUp;
public event System.Windows.Forms.MouseEventHandler MouseUp;
member this.MouseUp : System.Windows.Forms.MouseEventHandler 
Public Custom Event MouseUp As MouseEventHandler 

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 MouseUp eventos.In the example, an event handler reports on the occurrence of the MouseUp 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 de un tipo que hereda de ToolStripItem, como un ToolStripButton o ToolStripMenuItem.To run the example code, paste it into a project that contains an instance of a type that inherits from ToolStripItem, such as a ToolStripButton or ToolStripMenuItem. A continuación, asigne a la instancia ToolStripItem1 y asegúrese de que está asociado el controlador de eventos con el MouseUp eventos.Then name the instance ToolStripItem1 and ensure that the event handler is associated with the MouseUp event.

private void ToolStripItem1_MouseUp(Object sender, MouseEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Button", e.Button );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Clicks", e.Clicks );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "X", e.X );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Y", e.Y );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Delta", e.Delta );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Location", e.Location );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "MouseUp Event" );
}
Private Sub ToolStripItem1_MouseUp(sender as Object, e as MouseEventArgs) _ 
     Handles ToolStripItem1.MouseUp

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Button", e.Button)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Clicks", e.Clicks)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "X", e.X)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Y", e.Y)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Delta", e.Delta)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Location", e.Location)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"MouseUp Event")

End Sub

Comentarios

Los eventos del mouse se producen en el siguiente orden:Mouse events occur in the following order:

  1. MouseEnter

  2. MouseMove

  3. MouseHover o MouseDownMouseHover or MouseDown

  4. MouseUp

  5. MouseLeave

Para obtener más información sobre el manejo de eventos, consulte controlar y provocar eventos.For more information about handling events, see Handling and Raising Events.

Se aplica a

Consulte también: