MouseButtonEventArgs.ClickCount Property

Definition

단추를 클릭한 횟수를 가져옵니다.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

Property Value

Int32

마우스 단추를 클릭한 횟수입니다.The number of times the mouse button was clicked.

Examples

다음 예제에서는 MouseButtonEventHandler single, double, 또는 세 번 클릭이 발생 한 경우를 결정 합니다.The following example creates a MouseButtonEventHandler which determines if a single, double, or triple click occurred. ClickCount 속성 클릭 수가 결정 됩니다.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

Remarks

한 가지 용도 ClickCount 마우스 두 번 클릭이 발생 했는지 여부를 결정 하는 것입니다.One use of ClickCount is to determine whether a double mouse click has occurred. 일부 클래스와 같은 두 번 클릭에 대 한 이벤트를 노출 합니다 MouseDoubleClick 이벤트에는 Control 클래스.Some classes expose events for a double-click, such as the MouseDoubleClick event on the Control class. 두 번 클릭을 사용 하 여 검색할 수 두 번 클릭 이벤트를 클래스에 노출 되지 않습니다, 경우를 ClickCount 이벤트 데이터의 속성입니다.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.

Applies to

See also