Sdílet prostřednictvím


RecognitionAlternate.GetStrokesFromStrokeRanges Method

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

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Function GetStrokesFromStrokeRanges ( _
    s As Strokes _
) As Strokes
'Usage
Dim instance As RecognitionAlternate 
Dim s As Strokes 
Dim returnValue As Strokes 

returnValue = instance.GetStrokesFromStrokeRanges(s)
public Strokes GetStrokesFromStrokeRanges(
    Strokes s
)
public:
Strokes^ GetStrokesFromStrokeRanges(
    Strokes^ s
)
public function GetStrokesFromStrokeRanges(
    s : Strokes
) : Strokes

Parameters

Return Value

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

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

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.

[C#]

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);
    //...
}

This 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.

[Visual Basic]

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

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

RecognitionAlternate Class

RecognitionAlternate Members

Microsoft.Ink Namespace

RecognitionAlternate.GetStrokesFromTextRange

RecognitionAlternate.GetTextRangeFromStrokes

Strokes