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.SetStrokeTypeInkAnalyzer.SetStrokesType

示例

此示例定义 GetStrokeTypesInNode 方法,用以返回 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)));
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzer 类

InkAnalyzer 成员

Microsoft.Ink 命名空间

Microsoft.Ink.StrokeType