Compartir a través de


InkAnalyzer.GetStrokeType Method

Returns the type of a Stroke.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)

Syntax

'Declaration
Public Function GetStrokeType ( _
    stroke As Stroke _
) As StrokeType
'Usage
Dim instance As InkAnalyzer
Dim stroke As Stroke
Dim returnValue As StrokeType

returnValue = instance.GetStrokeType(stroke)
public StrokeType GetStrokeType (
    Stroke stroke
)
public:
StrokeType GetStrokeType (
    Stroke^ stroke
)
public StrokeType GetStrokeType (
    Stroke stroke
)
public function GetStrokeType (
    stroke : Stroke
) : StrokeType
Not applicable.

Parameters

  • stroke
    The stroke for which to return the classification.

Return Value

The classification of stroke.

Remarks

If the stroke's type is the Microsoft.Ink.StrokeType value Unspecified, the InkAnalyzer classifies the stroke during ink analysis. Otherwise, the InkAnalyzer uses the type set on the stroke.

To specify or change the stroke type, use InkAnalyzer.SetStrokeType or InkAnalyzer.SetStrokesType.

Example

This example defines a method, GetStrokeTypesInNode, for returning all the types for the strokes in a ContextNode.

''' <summary>
''' Returns the locale identifiers for all the strokes in the node.
''' </summary>
''' <param name="theInkAnalyzer">The ink analyzer containing the node.</param>
''' <param name="theContextNode">The node to check.</param>
''' <returns>An array of unique locale identifiers.</returns>
Private Function GetStrokeTypesInNode( _
    ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer, _
    ByVal theContextNode As Microsoft.Ink.ContextNode) _
    As Microsoft.Ink.StrokeType()

    ' Iterate through the strokes within the context node and add the
    ' stroke types to a collection.
    Dim theLanguages As New System.Collections.ArrayList()
    Dim theStroke As Microsoft.Ink.Stroke
    For Each theStroke In theContextNode.Strokes
        Dim theStrokeType As Microsoft.Ink.StrokeType = _
            theInkAnalyzer.GetStrokeType(theStroke)
        If Not theLanguages.Contains(theStrokeType) Then
            theLanguages.Add(theStrokeType)
        End If
    Next theStroke

    ' Return the elements of the collection as an array.
    Return CType(theLanguages.ToArray(GetType(Microsoft.Ink.StrokeType)), _
        Microsoft.Ink.StrokeType())

End Function 'GetStrokeTypesInNode
/// <summary>
/// Returns the locale identifiers for all the strokes in the node.
/// </summary>
/// <param name="theInkAnalyzer">The ink analyzer containing the node.</param>
/// <param name="theContextNode">The node to check.</param>
/// <returns>An array of unique locale identifiers.</returns>
private Microsoft.Ink.StrokeType[] GetStrokeTypesInNode(
    Microsoft.Ink.InkAnalyzer theInkAnalyzer,
    Microsoft.Ink.ContextNode theContextNode)
{
    // Iterate through the strokes within the context node and add the
    // stroke types to a collection.
    System.Collections.ArrayList theLanguages =
        new System.Collections.ArrayList();
    foreach (Microsoft.Ink.Stroke theStroke in theContextNode.Strokes)
    {
        Microsoft.Ink.StrokeType theStrokeType =
            theInkAnalyzer.GetStrokeType(theStroke);
        if (!theLanguages.Contains(theStrokeType))
        {
            theLanguages.Add(theStrokeType);
        }
    }

    // Return the elements of the collection as an array.
    return (Microsoft.Ink.StrokeType[])
        (theLanguages.ToArray(typeof(Microsoft.Ink.StrokeType)));
}

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

InkAnalyzer Class
InkAnalyzer Members
Microsoft.Ink Namespace
Microsoft.Ink.StrokeType