MouseWheelEventHandler 대리자

정의

관련 연결된 이벤트와 미리 보기 이벤트뿐만 아니라 MouseWheelMouseWheel 라우트된 이벤트를 처리할 메서드를 나타냅니다.

public delegate void MouseWheelEventHandler(System::Object ^ sender, MouseWheelEventArgs ^ e);
public delegate void MouseWheelEventHandler(object sender, MouseWheelEventArgs e);
type MouseWheelEventHandler = delegate of obj * MouseWheelEventArgs -> unit
Public Delegate Sub MouseWheelEventHandler(sender As Object, e As MouseWheelEventArgs)

매개 변수

sender
Object

이벤트 처리기가 연결된 개체입니다.

e
MouseWheelEventArgs

이벤트 데이터입니다.

예제

이동 하는 다음 예제는 TextBox, 첨부 되는 Canvas경우에 위쪽으로 마우스 휠을 Delta 가 양수이 고 이동의 TextBox 아래쪽 이면 마우스 휠을 Delta 음수입니다.

// 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

설명

이 대리자는 다음 연결 된 이벤트와 함께 사용 됩니다.

이 대리자는 다음과 같은 라우트된 이벤트와 함께 사용 됩니다. 이러한 라우트된 이벤트는 이전에 나열된 연결된 이벤트를 전달하여 WPF의 일반 요소 모델에 더 쉽게 액세스할 수 있도록 합니다.

연결 된 이벤트 및 기본 요소의 라우트된 이벤트에 이벤트 데이터를 공유 하 고 버전 라우트된 이벤트의 터널링 및 버블링 이벤트 데이터를 공유할 수도 있습니다. 이 이벤트 경로 따라 이동할 때 이벤트의 처리 된 특성에 영향을 줄 수 있습니다. 자세한 내용은 참조 하세요 입력 개요합니다.

Delta 속성은 마우스 휠을 (사용자 반대쪽)으로 이동 하는 경우에 양수 또는 음수 (사용자) 입장에서 마우스 휠을 아래로 이동 합니다.

확장 메서드

GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

추가 정보