次の方法で共有


InkAnalyzer.GetStrokeLanguageId メソッド

指定された Stroke のロケール識別子を返します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink.Analysis (Microsoft.Ink.Analysis.dll 内)

構文

'宣言
Public Function GetStrokeLanguageId ( _
    stroke As Stroke _
) As Integer
'使用
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

パラメータ

戻り値

型 : System.Int32
stroke のロケール識別子。

解説

ストロークのロケールは、AddStroke または AddStrokes を呼び出すことにより、ストロークを追加したときに設定されます。ストロークのロケールを変更するには、InkAnalyzer.SetStrokeLanguageId を呼び出します。

この例では、ContextNode 内のストロークのすべてのロケール識別子を返すために 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 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)));
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkAnalyzer クラス

InkAnalyzer メンバ

Microsoft.Ink 名前空間