Share via


RecognitionAlternate.GetTextRangeFromStrokes Method

RecognitionAlternate.GetTextRangeFromStrokes Method

Determines the smallest range of recognized text for which the recognizer can return an alternate that contains a known Strokes collection.

Definition

Visual Basic .NET Public Sub GetTextRangeFromStrokes( _
ByVal s As Strokes, _
ByRef selectionStart As Integer, _
ByRef selectionLength As Integer _
)
C# public void GetTextRangeFromStrokes(
Strokes s,
ref int selectionStart,
ref int selectionLength
);
Managed C++ public: void GetTextRangeFromStrokes(
Strokes *s,
int **selectionStart,
int **selectionLength
);

Parameters

s Microsoft.Ink.Strokes. The Strokes collection contained within the alternate.
selectionStart System.Int32. The start position of the range of recognized text.
selectionLength System.Int32. The length of the range of recognized text.

Exceptions

ArgumentNullException Leave Site: One of the parameters is null (Nothing in Microsoft® Visual Basic® .NET). The caller must specify a Strokes collection.

Remarks

Use this method to retrieve the text that corresponds to a specified range of Stroke objects. For example, consider a Strokes collection, "how are you", that was drawn using nine strokes (one for each letter and three for each word). If a collection that consists of the sixth and seventh strokes is passed in, corresponding to characters "e" and "y", the text range returned matches the alternate containing "are you" and the selection start and length matches this substring.

Examples

[C#]

This C# example calls the GetTextRangeFromStrokes method on the TopAlternate property of a RecognitionResult object, theRecognitionResult, passing in a Strokes collection from within the strokes that make up the recognition result in theStrokes.

// . . .
int theStart = 0;
int theLength = 0;
theRecognitionResult.TopAlternate.GetTextRangeFromStrokes(theStrokes, ref theStart, ref theLength);
// . . .

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example calls the GetTextRangeFromStrokes method on the TopAlternate property of a RecognitionResult object, theRecognitionResult, passing in a Strokes collection from within the strokes that make up the recognition result in theStrokes.

' . . .
Dim theStart As Integer = 0
Dim theLength As Integer = 0
TheRecognitionResult.TopAlternate.GetTextRangeFromStrokes(theStrokes, _
    theStart, theLength)
' . . .

See Also