MouseButtonEventArgs.ClickCount MouseButtonEventArgs.ClickCount MouseButtonEventArgs.ClickCount MouseButtonEventArgs.ClickCount Property

Definición

Obtiene el número de veces que se ha hecho clic en el botón.Gets the number of times the button was clicked.

public:
 property int ClickCount { int get(); };
public int ClickCount { get; }
member this.ClickCount : int
Public ReadOnly Property ClickCount As Integer

Valor de propiedad

Número de veces que se ha hecho clic en el botón del mouse.The number of times the mouse button was clicked.

Ejemplos

En el ejemplo siguiente se crea un MouseButtonEventHandler que determina si se ha producido un clic single, doble o triple.The following example creates a MouseButtonEventHandler which determines if a single, double, or triple click occurred. ClickCount propiedad se usa para determinar el número de clics.ClickCount property is used to determine the number of clicks.

private void OnMouseDownClickCount(object sender, MouseButtonEventArgs e)
{
    // Checks the number of clicks.
    if (e.ClickCount == 1)
    {
        // Single Click occurred.
        lblClickCount.Content = "Single Click";
    }
    if (e.ClickCount == 2)
    {
        // Double Click occurred.
        lblClickCount.Content = "Double Click";
    }
    if (e.ClickCount >= 3)
    {
        // Triple Click occurred.
        lblClickCount.Content = "Triple Click";
    }
}
Private Sub OnMouseDownClickCount(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
    ' Checks the number of clicks.
    If e.ClickCount = 1 Then
        ' Single Click occurred.
        lblClickCount.Content = "Single Click"
    End If
    If e.ClickCount = 2 Then
        ' Double Click occurred.
        lblClickCount.Content = "Double Click"
    End If
    If e.ClickCount >= 3 Then
        ' Triple Click occurred.
        lblClickCount.Content = "Triple Click"
    End If
End Sub

Comentarios

Un uso de ClickCount consiste en determinar si se ha producido un doble clic.One use of ClickCount is to determine whether a double mouse click has occurred. Algunas clases exponen eventos de doble clic, tales como la MouseDoubleClick eventos en el Control clase.Some classes expose events for a double-click, such as the MouseDoubleClick event on the Control class. Cuando no se expone un evento de doble clic en una clase, se puede detectar un doble clic mediante el uso de la ClickCount propiedad en los datos del evento.When a double click event is not exposed on a class, a double click can be detected by using the ClickCount property on the event data.

Se aplica a

Consulte también: