Compartir a través de


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 Strokes GetStrokesFromStrokeRanges (
    Strokes s
)
public function GetStrokesFromStrokeRanges (
    s : Strokes
) : Strokes
Not applicable.

Parameters

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

Return Value

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.

Example

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

RecognitionAlternate Class
RecognitionAlternate Members
Microsoft.Ink Namespace
RecognitionAlternate.GetStrokesFromTextRange
RecognitionAlternate.GetTextRangeFromStrokes
Strokes