MouseEventArgs.Delta 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
마우스 휠이 회전한 분리 횟수의 부호 있는 개수를 가져오고 WHEEL_DELTA 상수를 곱합니다. 분리는 마우스 휠의 한 단계입니다.
public:
property int Delta { int get(); };
public int Delta { get; }
member this.Delta : int
Public ReadOnly Property Delta As Integer
속성 값
마우스 휠이 회전한 분리 횟수의 부호 있는 개수에 WHEEL_DELTA 상수를 곱합니다.
예제
다음 코드 예제에서는이 멤버의 사용을 보여 줍니다. 이 예제에서 이벤트 처리기는 이벤트의 발생을 보고합니다 Control.MouseClick . 이 보고서는 이벤트가 발생하는 시기를 학습하는 데 도움이 되며 디버깅에 도움이 될 수 있습니다. 여러 이벤트 또는 자주 발생하는 이벤트에 대해 보고하려면 메시지를 여러 줄MessageBox.Show로 Console.WriteLine 대체 TextBox 하거나 추가해 보세요.
예제 코드를 실행하려면 예제 코드를 상속 Control하는 형식의 인스턴스(예 Button : a 또는 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
설명
마우스 휠은 휠과 마우스 단추의 기능을 결합합니다. 휠에는 불연속, 고르게 간격이 있는 노치가 있습니다. 휠을 회전하면 각 노치에 도달하면 휠 메시지가 전송됩니다. 원 휠 노치( detent)는 windows 상수 WHEEL_DELTA 120으로 정의됩니다. 양수 값은 휠이 앞으로 회전했음을 나타냅니다(사용자로부터 멀어짐). 음수 값은 휠이 뒤로(사용자 쪽으로) 회전했음을 나타냅니다.
현재 값 120은 하나의 분리에 대한 표준입니다. 고해상도 마우스가 도입되면 WHEEL_DELTA 정의가 작아질 수 있습니다. 대부분의 애플리케이션은 집계 합계가 아닌 양수 또는 음수 값을 확인해야 합니다.