KeyGesture.Matches(Object, InputEventArgs) 메서드

정의

지정된 KeyGesture 개체와 연결된 입력과 일치하는지 여부를 InputEventArgs 확인합니다.

public:
 override bool Matches(System::Object ^ targetElement, System::Windows::Input::InputEventArgs ^ inputEventArgs);
public override bool Matches(object targetElement, System.Windows.Input.InputEventArgs inputEventArgs);
override this.Matches : obj * System.Windows.Input.InputEventArgs -> bool
Public Overrides Function Matches (targetElement As Object, inputEventArgs As InputEventArgs) As Boolean

매개 변수

targetElement
Object

대상입니다.

inputEventArgs
InputEventArgs

이 제스처를 비교할 입력 이벤트 데이터입니다.

반품

true 이벤트 데이터가 일치하면 이 KeyGesture고, false그렇지 않으면 .

예제

다음 예제에서는 인스턴스와 연결된 입력과 일치하는지 여부를 KeyGesture 테스트하는 방법을 보여 줍니다 InputEventArgs. 메서드를 KeyDown 사용하여 KeyGesture 이벤트 데이터를 Matches 비교하는 이벤트 처리기가 만들어집니다.

private void OnKeyDown(object sender, KeyEventArgs e)
{
    KeyGesture keyGesture = new KeyGesture(Key.B, ModifierKeys.Control);

    if(keyGesture.Matches(null, e))
    {
        MessageBox.Show("Trapped Key Gesture");
    }
}
Private Overloads Sub OnKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
    Dim keyGesture As New KeyGesture(Key.B, ModifierKeys.Control)

    If keyGesture.Matches(Nothing, e) Then
        MessageBox.Show("Trapped Key Gesture")
    End If
End Sub

설명

targetElement 명령을 특정 요소에 대해 호출해야 하는지 여부를 보다 구체적으로 결정하는 데 사용할 수 있습니다.

적용 대상