다음을 통해 공유


RecognitionResult.SetResultOnStrokes 메서드

업데이트: 2007년 11월

결과를 생성하는 데 사용된 Strokes 컬렉션에 RecognitionResult 개체를 할당합니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink(Microsoft.Ink.dll)

구문

‘선언
Public Sub SetResultOnStrokes
‘사용 방법
Dim instance As RecognitionResult

instance.SetResultOnStrokes()
public void SetResultOnStrokes()
public:
void SetResultOnStrokes()
public void SetResultOnStrokes()
public function SetResultOnStrokes()

설명

모든 Strokes 컬렉션에 인식 결과를 자동으로 할당하면 시스템 성능이 저하될 수 있으므로 기본적으로는 결과가 Strokes 컬렉션에 연결되지 않습니다. Strokes 컬렉션에 결과를 할당하려면 SetResultOnStrokes 메서드를 호출해야 합니다. Strokes 컬렉션에 대한 인식 결과를 반환하려면 Strokes 컬렉션의 RecognitionResult 속성을 사용합니다. Strokes 컬렉션에 결과를 할당한 후 스트로크를 CustomStrokes 컬렉션에 저장할 수 있습니다. 이러한 사용자 지정 스트로크와 RecognitionResult를 유지한 후 이후에 검색하여 사용할 수 있습니다.

예제

이 예제에서는 메뉴 항목이나 단추를 클릭하는 등의 사용자 동작에 응답하여 동기적 인식을 처리합니다. 우선 InkOverlay 개체에 연결된 Strokes 컬렉션을 사용하여 RecognizerContext 개체의 Strokes 컬렉션을 할당하고 스트로크 개수를 확인합니다. Strokes 컬렉션에 Stroke 개체가 최소한 하나 이상 들어 있으면 Recognize 메서드를 호출하여 인식 프로세스를 시작합니다. 인식에 성공하면 SetResultOnStrokes 메서드를 호출하여 RecognizerContext 개체를 해당 Strokes 컬렉션에 연결합니다. 마지막으로 Strokes 컬렉션을 명명된 CustomStrokes 컬렉션으로 저장합니다. 이렇게 하면 연결된 RecognitionResult도 저장됩니다.

' assign strokes collection from the collected strokes
Me.mRecognizerContext.Strokes = Me.mInkOverlay.Ink.Strokes
' check stroke count. Recognize() will throw exception if no strokes
If Me.mRecognizerContext.Strokes.Count > 0 Then
    Dim status As RecognitionStatus
    ' perform the recognition
    Dim rResult As RecognitionResult = Me.mRecognizerContext.Recognize(status)
    ' check status
    If RecognitionStatus.NoError = status Then
        ' attach RecognitionResult to the Strokes collection
        rResult.SetResultOnStrokes()
        ' save the strokes collection (with RecognitionResult attached)
        Try
            mInkOverlay.Ink.CustomStrokes.Add("customCollectionName", rResult.Strokes)
        Catch ex As ArgumentException
            ' this exception is raised when the named collection already exists
        End Try
    End If
End If
// assign strokes collection from the collected strokes
this.mRecognizerContext.Strokes = this.mInkOverlay.Ink.Strokes;
// check stroke count. Recognize() will throw exception if no strokes
if (this.mRecognizerContext.Strokes.Count > 0)
{
    RecognitionStatus status;
    // perform the recognition
    RecognitionResult rResult = this.mRecognizerContext.Recognize(out status);
    // check status
    if (RecognitionStatus.NoError == status)
    {
        // attach RecognitionResult to the Strokes collection
        rResult.SetResultOnStrokes();
        // save the strokes collection (with RecognitionResult attached)
        try
        {
            mInkOverlay.Ink.CustomStrokes.Add("customCollectionName", rResult.Strokes);
        }
        catch (ArgumentException)
        {
            // this exception is raised when the named collection already exists
        }
    }
}

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

RecognitionResult 클래스

RecognitionResult 멤버

Microsoft.Ink 네임스페이스

Strokes

CustomStrokes