MouseWheelEventArgs.Delta 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
마우스 휠이 변경된 크기를 나타내는 값을 가져옵니다.
public:
property int Delta { int get(); };
public int Delta { get; }
member this.Delta : int
Public ReadOnly Property Delta As Integer
속성 값
휠이 변경된 양입니다. 이 값은 마우스 휠이 위쪽 방향(사용자 멀리)으로 회전하는 경우 양수이거나 마우스 휠이 아래쪽 방향으로 회전하는 경우(사용자 쪽으로) 음수입니다.
예제
다음은 마우스 휠이 TextBox 양수이면 위로 이동하고 마우스 휠 DeltaTextBox 이 음수 Delta 이면 아래로 이동하는 예제입니다. 에 TextBox 연결되어 있습니다 Canvas.
// Moves the TextBox named box when the mouse wheel is rotated.
// The TextBox is on a Canvas named MainCanvas.
private void MouseWheelHandler(object sender, MouseWheelEventArgs e)
{
// If the mouse wheel delta is positive, move the box up.
if (e.Delta > 0)
{
if (Canvas.GetTop(box) >= 1)
{
Canvas.SetTop(box, Canvas.GetTop(box) - 1);
}
}
// If the mouse wheel delta is negative, move the box down.
if (e.Delta < 0)
{
if ((Canvas.GetTop(box) + box.Height) <= (MainCanvas.Height))
{
Canvas.SetTop(box, Canvas.GetTop(box) + 1);
}
}
}
' Moves the TextBox named box when the mouse wheel is rotated.
' The TextBox is on a Canvas named MainCanvas.
Private Sub MouseWheelHandler(ByVal sender As Object, ByVal e As MouseWheelEventArgs)
' If the mouse wheel delta is positive, move the box up.
If e.Delta > 0 Then
If Canvas.GetTop(box) >= 1 Then
Canvas.SetTop(box, Canvas.GetTop(box) - 1)
End If
End If
' If the mouse wheel delta is negative, move the box down.
If e.Delta < 0 Then
If (Canvas.GetTop(box) + box.Height) <= MainCanvas.Height Then
Canvas.SetTop(box, Canvas.GetTop(box) + 1)
End If
End If
End Sub
설명
이 값의 유효 상한 및 하한 범위는 잠재적으로 디바이스 구현 또는 이벤트를 발생시킨 다른 호출자에서 발생하므로 정의되지 않습니다.