GestureRecognizer.Recognize(StrokeCollection) 메서드

정의

지정한 StrokeCollection에서 제스처를 찾습니다.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Windows::Ink::GestureRecognitionResult ^> ^ Recognize(System::Windows::Ink::StrokeCollection ^ strokes);
[System.Security.SecurityCritical]
public System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Ink.GestureRecognitionResult> Recognize (System.Windows.Ink.StrokeCollection strokes);
public System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Ink.GestureRecognitionResult> Recognize (System.Windows.Ink.StrokeCollection strokes);
[<System.Security.SecurityCritical>]
member this.Recognize : System.Windows.Ink.StrokeCollection -> System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Ink.GestureRecognitionResult>
member this.Recognize : System.Windows.Ink.StrokeCollection -> System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Ink.GestureRecognitionResult>
Public Function Recognize (strokes As StrokeCollection) As ReadOnlyCollection(Of GestureRecognitionResult)

매개 변수

strokes
StrokeCollection

제스처를 검색할 StrokeCollection입니다.

반환

GestureRecognitionResult에서 인식한 애플리케이션 제스처가 들어 있는 GestureRecognizer 형식의 배열입니다.

특성

예제

다음 예에서는 가 제스처인지 여부를 Stroke 확인하는 방법을 보여 줍니다 ScratchOut .

private bool InterpretScratchoutGesture(Stroke stroke)
{
    // Attempt to instantiate a recognizer for scratchout gestures.
    ApplicationGesture[] gestures = { ApplicationGesture.ScratchOut };
    GestureRecognizer recognizer = new GestureRecognizer(gestures);

    if (!recognizer.IsRecognizerAvailable)
        return false;

    // Determine if the stroke was a scratchout gesture.
    StrokeCollection gestureStrokes = new StrokeCollection();
    gestureStrokes.Add(stroke);

    ReadOnlyCollection<GestureRecognitionResult> results = recognizer.Recognize(gestureStrokes);

    if (results.Count == 0)
        return false;

    // Results are returned sorted in order strongest-to-weakest; 
    // we need only analyze the first (strongest) result.
    if (results[0].ApplicationGesture == ApplicationGesture.ScratchOut &&
          results[0].RecognitionConfidence == RecognitionConfidence.Strong)
    {
        // Use the scratchout stroke to perform hit-testing and 
        // erase existing strokes, as necessary.
        return true;
    }
    else
    {
        // Not a gesture: display the stroke normally.
        return false;
    }
}
Private Function InterpretScratchoutGesture(ByVal stroke As Stroke) As Boolean
    ' Attempt to instantiate a recognizer for scratchout gestures.
    Dim gestures() As ApplicationGesture = {ApplicationGesture.ScratchOut}

    Dim recognizer As New GestureRecognizer(gestures)

    If Not recognizer.IsRecognizerAvailable Then
        Return False
    End If

    ' Determine if the stroke was a scratchout gesture.
    Dim gestureStrokes As StrokeCollection = New StrokeCollection()
    gestureStrokes.Add(stroke)

    Dim results As ReadOnlyCollection(Of GestureRecognitionResult)
    results = recognizer.Recognize(gestureStrokes)

    If results.Count = 0 Then
        Return False
    End If

    ' Results are returned sorted in order strongest-to-weakest; 
    ' we need only analyze the first (strongest) result.
    If (results(0).ApplicationGesture = ApplicationGesture.ScratchOut) Then

        ' Use the scratchout stroke to perform hit-testing and 
        ' erase existing strokes, as necessary.
        Return True
    Else
        ' Not a gesture: display the stroke normally.
        Return False
    End If
End Function

설명

메서드에서 반환된 Recognize 배열은 속성별로 GestureRecognitionResult.RecognitionConfidence 정렬됩니다. 예를 들어 은 Recognize 다음 값을 가진 GestureRecognitionResult 배열을 반환할 수 있습니다.

인덱스 ApplicationGesture RecognitionConfidence
0 Check Strong
1 NoGesture Intermediate
2 Curlicue Poor
3 DoubleCurlicue Poor

즉를 GestureRecognizer 가능성이 것을 인식 하는 Stroke 가능성이 비교적에 확인 표시는 Stroke 하지 제스처에 전혀 가능성이를 Stroke 소용돌이 또는 이중 소용돌이.

참고

합니다 Recognize 메서드는 배열을 반환할 수 있습니다 NoGesture 높여서 RecognitionConfidence 보다 다른 애플리케이션 제스처입니다. 이 가능성이 임을 의미 하는 Stroke 더 낮은 요소가 제스처 대신 제스처를 아닙니다 RecognitionConfidence.

적용 대상