Share via


InkAnalyzer.GetStrokeLanguageId Method

Returns the locale identifier of the specified Stroke.

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

Syntax

'Declaration
Public Function GetStrokeLanguageId ( _
    stroke As Stroke _
) As Integer
'Usage
Dim instance As InkAnalyzer
Dim stroke As Stroke
Dim returnValue As Integer

returnValue = instance.GetStrokeLanguageId(stroke)
public int GetStrokeLanguageId (
    Stroke stroke
)
public:
int GetStrokeLanguageId (
    Stroke^ stroke
)
public int GetStrokeLanguageId (
    Stroke stroke
)
public function GetStrokeLanguageId (
    stroke : Stroke
) : int
Not applicable.

Parameters

  • stroke
    The stroke for which to return the locale identifier.

Return Value

The locale identifier of stroke.

Remarks

The stroke's locale is set when you add the stroke by calling AddStroke or AddStrokes. To change the stroke's locale call, InkAnalyzer.SetStrokeLanguageId.

Example

This example defines a method, GetLanguagesInNode, for returning all the locale identifiers 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 GetLanguagesInNode( _
    ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer, _
    ByVal theContextNode As Microsoft.Ink.ContextNode) As Integer()

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

    ' Return the elements of the collection as an array.
    Return CType(theLanguages.ToArray(GetType(Integer)), Integer())

End Function 'GetLanguagesInNode
/// <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 int[] GetLanguagesInNode(
    Microsoft.Ink.InkAnalyzer theInkAnalyzer,
    Microsoft.Ink.ContextNode theContextNode)
{
    // Iterate through the strokes within the context node and add the locale
    // identifiers to a collection.
    System.Collections.ArrayList theLanguages =
        new System.Collections.ArrayList();
    foreach (Microsoft.Ink.Stroke theStroke in theContextNode.Strokes)
    {
        int theStrokeLanguage =
            theInkAnalyzer.GetStrokeLanguageId(theStroke);
        if (!theLanguages.Contains(theStrokeLanguage))
        {
            theLanguages.Add(theStrokeLanguage);
        }
    }

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

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