共用方式為


RecognizerContext.EndInkInput Method

RecognizerContext.EndInkInput Method

Ends ink input to the RecognizerContext object.

Definition

Visual Basic .NET Public Sub EndInkInput()
C# public void EndInkInput();
Managed C++ public: void EndInkInput();

Exceptions

ObjectDisposedException Leave Site: The RecognizerContext object is disposed.

Remarks

After you call this method, you cannot add Stroke objects to the RecognizerContext object.

Partial recognition is the ability of the recognizer to return results even if the application has not called the EndInkInput method, which signals to the application that all the ink has been entered. Partial recognition occurs only if the recognizer can determine that ink has been entered before a call to EndInkInput, and not all recognizers support this feature. Recognizers that do not support partial recognition do not return any result until EndInkInput is called.

Incremental recognition is the ability of the recognizer to process only a small part of the ink that has been passed to it and return a result. For example, consider that an application contains five lines of ink and uses a recognizer of Latin script. The recognizer can process only one line at a time and return a result. This process is used in the idle loop of the background processing thread.

If the recognizer supports partial recognition, it can return a result even if the EndInkInput method has not been called. Microsoft® recognizers of Latin script return the same results whether or not you call EndInkInput.

Note: Results derived from partial recognition may be different from the results if you call EndInkInput. By using partial recognition you do not require the recognizer to return results for all of the ink. Losing the surrounding context of some ink may adversely affect recognition.

Examples

[C#]

This C# example shows an event handler for a button control's Click event, buttonSubmit_Click, that recognizes the valid ink in the Strokes collection assigned to the RecognizerContext, theRecognizerContext, (declared in a containing scope) and displays it in a text box if no errors occur.

private void buttonSubmit_Click(object sender, System.EventArgs e)
{
    theRecognizerContext.EndInkInput();
    RecognitionStatus theRecognitionStatus;
    theRecognitionResult = theRecognizerContext.Recognize(out theRecognitionStatus);
    if (RecognitionStatus.NoError == theRecognitionStatus)
        theTextBox.Text = theRecognitionResult.TopString;
    else
        // Handle the error cases here...
        theTextBox.Text = "";
}

[Visual Basic .NET]

This Microsoft Visual Basic® .NET example shows an event handler for a button control's Click event, buttonSubmit_Click, that recognizes the valid ink in the Strokes collection assigned to the RecognizerContext, theRecognizerContext, (declared in a containing scope) and displays it in a text box if no errors occur.

Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
    theRecognizerContext.EndInkInput()
    Dim theRecognitionStatus As RecognitionStatus
    theRecognitionResult = theRecognizerContext.Recognize(theRecognitionStatus)
    If RecognitionStatus.NoError = theRecognitionStatus Then
        RichTextBox1.Text = theRecognitionResult.TopString
    Else
        'Handle the error conditions here.
        RichTextBox1.Text = ""
    End If
End Sub