次の方法で共有


InkAnalyzer.GetStrokeType メソッド

Stroke の型を返します。

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

構文

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

パラメータ

戻り値

型 : Microsoft.Ink.StrokeType
stroke の分類。

解説

ストロークの型が Microsoft.Ink.StrokeTypeUnspecified の場合、InkAnalyzer はインク分析時にストロークを分類します。それ以外の場合、InkAnalyzer はストロークで設定された型を使用します。

ストロークの型を指定または変更するには、InkAnalyzer.SetStrokeType または InkAnalyzer.SetStrokesType を使用します。

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

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkAnalyzer クラス

InkAnalyzer メンバ

Microsoft.Ink 名前空間

Microsoft.Ink.StrokeType