MouseEventArgs.Clicks 속성

정의

마우스 단추를 눌렀다 놓은 횟수를 가져옵니다.

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

속성 값

마우스 단추를 눌렀다 놓은 횟수가 포함된 Int32입니다.

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다. 예제에서는 이벤트 처리기에서 보고서를 Control.MouseClick 이벤트입니다. 이 보고서는 이벤트가 발생하는 시기를 학습하는 데 도움이 되며 디버깅에 도움이 될 수 있습니다. 자주 발생 하는 이벤트 또는 여러 이벤트를 보고 하려면 바꾸는 것이 좋습니다 MessageBox.Show 사용 하 여 Console.WriteLine 줄에 메시지를 추가 또는 TextBox합니다.

예제 코드를 실행 하려면에서 상속 되는 형식의 인스턴스를 포함 하는 프로젝트에 붙여넣습니다 Control와 같은 Button 또는 ComboBox합니다. 다음 인스턴스 이름을 Control1 이벤트 처리기를 연결 된 확인 된 Control.MouseClick 이벤트입니다.

private void Control1_MouseClick(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(), "MouseClick Event" );
}
Private Sub Control1_MouseClick(sender as Object, e as MouseEventArgs) _ 
     Handles Control1.MouseClick

    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(),"MouseClick Event")

End Sub

설명

Windows 인터페이스를 정의 하지만 표준 마우스 이벤트로 한 번 또는 두 번 클릭, 개별 애플리케이션에는 단일 이벤트로 더 많은 한 번의 클릭 만으로 해석할 수 있습니다.

적용 대상

추가 정보