Partager via


InkAnalyzer.GetStrokeType, méthode

Mise à jour : November 2007

Retourne le type d'un Stroke.

Espace de noms :  Microsoft.Ink
Assembly :  Microsoft.Ink.Analysis (dans Microsoft.Ink.Analysis.dll)

Syntaxe

'Déclaration
Public Function GetStrokeType ( _
    stroke As Stroke _
) As StrokeType
'Utilisation
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

Paramètres

Valeur de retour

Type : Microsoft.Ink.StrokeType
Classification de stroke.

Notes

Si le type du trait correspond à la valeur Unspecified du Microsoft.Ink.StrokeType, le InkAnalyzer classifie le trait pendant l'analyse d'entrée manuscrite. Sinon, le InkAnalyzer utilise le type défini pour le trait.

Pour spécifier ou modifier le type de trait, utilisez la méthode InkAnalyzer.SetStrokeType ou InkAnalyzer.SetStrokesType.

Exemples

Cet exemple définit une méthode, GetStrokeTypesInNode, qui permet de retourner tous les types pour les traits d'un 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)));
}

Plateformes

Windows Vista

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Framework

Pris en charge dans : 3.0

Voir aussi

Référence

InkAnalyzer, classe

Membres InkAnalyzer

Microsoft.Ink, espace de noms

Microsoft.Ink.StrokeType