Share via


RecognitionAlternate.GetStrokesFromStrokeRanges Method

RecognitionAlternate.GetStrokesFromStrokeRanges Method

Returns the smallest Strokes collection that contains a known Strokes collection and for which the recognizer can provide alternates.

Definition

Visual Basic .NET Public Function GetStrokesFromStrokeRanges( _
ByVal s As Strokes _
) As Strokes
C# public Strokes GetStrokesFromStrokeRanges(
Strokes s
);
Managed C++ public: Strokes* GetStrokesFromStrokeRanges(
Strokes *s
);

Parameters

s Microsoft.Ink.Strokes. The Strokes collection to use to find the smallest Strokes collection of the recognition result alternate that contains this collection.

Return Value

Microsoft.Ink.Strokes. Returns the smallest Strokes collection that contains a known Strokes collection and for which the recognizer can provide alternates.

Exceptions

ArgumentNullException Leave Site: The parameter is null (Nothing in Microsoft® Visual Basic® .NET).

Remarks

The returned Strokes collection may match the input collection, or it may be larger if the input collection matches only part of the smallest recognition result that includes all of the input strokes.

This method is most useful for single-click word selection. For example, to return the strokes that make up the word you click, you can click a Stroke object, call the HitTest method of the Ink object to return that stroke, and then call GetStrokesFromStrokeRanges.

The stroke ranges are valid until the Ink object is modified.

Examples

[C#]

This C# example returns the Strokes collection that is associated with the smallest set of RecognitionAlternate objects that include the Strokes collection selected by clicking the mouse at ptMouseDown in the drawing space of Form1, where the ink strokes have been recognized and the result is in a RecognitionResult object, theRecognitionResult.

Strokes hitStrokes;
Strokes altStrokes;
// Convert the mouse down to ink space coordinates
theInkCollector.Renderer.PixelToInkSpace(this.CreateGraphics(), ref ptMouseDown);
// Get the strokes hit by the mouse (within a radius of 100 HIMETRIC)
hitStrokes = theInkCollector.Ink.HitTest(ptMouseDown, 100);
if (hitStrokes.Count > 0)
{
    altStrokes = theRecognitionResult.TopAlternate.GetStrokesFromStrokeRanges(hitStrokes);
    //...
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example returns the Strokes collection that is associated with the smallest set of RecognitionAlternate objects that include the Strokes collection selected by clicking the mouse at ptMouseDown in the drawing space of Form1, where the ink strokes have been recognized and the result is in a RecognitionResult object, theRecognitionResult.

Dim hitStrokes As Strokes
Dim altStrokes As Strokes
' Convert the mouse down to ink space coordinates
theInkCollector.Renderer.PixelToInkSpace( _
    Me.CreateGraphics(), ptMouseDown)
' Get the strokes hit by the mouse (within a radius of 100 HIMETRIC)
hitStrokes = theInkCollector.Ink.HitTest(ptMouseDown, 100)
If hitStrokes.Count > 0 Then
    altStrokes = theRecognitionResult.TopAlternate.GetStrokesFromStrokeRanges( _
        hitStrokes)
    '...
End If

See Also