Share via


InkRecognizer, classe

Mise à jour : November 2007

Permet d'accéder aux modules de reconnaissance de l'écriture manuscrite pour les utiliser avec l'analyse d'entrée manuscrite.

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

Syntaxe

'Déclaration
Public Class InkRecognizer _
    Implements IDisposable
'Utilisation
Dim instance As InkRecognizer
public class InkRecognizer : IDisposable
public ref class InkRecognizer : IDisposable
public class InkRecognizer implements IDisposable
public class InkRecognizer implements IDisposable

Notes

Un module de reconnaissance comporte des attributs et des propriétés spécifiques qui lui permettent d'effectuer une reconnaissance. Les propriétés d'un module de reconnaissance doivent être définies avant le lancement de la reconnaissance. Les types de propriétés qu'un module de reconnaissance prend en charge déterminent les types de reconnaissances qu'il peut effectuer. Par exemple, si un module de reconnaissance ne prend pas en charge l'écriture manuscrite cursive, il retourne des résultats inexacts lorsque celle-ci est utilisée.

Un module de reconnaissance comporte également une fonctionnalité intégrée qui gère automatiquement de nombreux aspects de l'écriture manuscrite. Par exemple, il détermine les mesures des lignes sur lesquelles les traits sont dessinés. Vous pouvez retourner le numéro de ligne d'un trait, mais grâce à la fonctionnalité intégrée du module de reconnaissance, il n'est pas nécessaire de spécifier le mode de détermination de ces métriques de ligne.

Le InkAnalyzer gère un InkRecognizerCollection des modules de reconnaissance disponibles. Utilisez la méthode GetInkRecognizersByPriority pour accéder à cette collection.

Exemples

L'exemple suivant définit une méthode qui retourne une chaîne contenant des informations relatives au InkRecognizer spécifié. Les méthodes d'assistance ListCapabilities et GetPropertyName, qui utilisent la réflexion pour retourner des informations relatives à des fonctions et des propriétés spécifiques du InkRecognizer, ne sont pas présentées dans cet exemple.

''' <summary>
''' Generates a string containing information about the specified InkRecognizer.
''' </summary>
''' <param name="theInkRecognizer">
''' The InkRecognizer from which to gather the information.
''' </param>
''' <returns>
''' A string containing information about the specified InkRecognizer.
''' </returns>
Private Function GetInkRecognizerData( _
    ByVal theInkRecognizer As Microsoft.Ink.InkRecognizer) As String

    ' Create a StringBuilder in which to collect the information.
    Dim result As New System.Text.StringBuilder

    ' Add the name of the recognizer.
    result.AppendLine(String.Format("Name: {0}", theInkRecognizer.Name))

    ' Add the GUID of the recognizer.
    result.AppendLine(String.Format("   Guid: {0}", theInkRecognizer.Guid))

    ' Add the vendor of the recognizer.
    result.AppendLine(String.Format("   Vendor: {0}", theInkRecognizer.Vendor))

    ' Add the languages the recognizer supports.
    result.AppendLine("   Supports the following languages:")
    If (0 = theInkRecognizer.GetLanguages().Length) Then
        result.AppendLine("      No languages supported.")
    Else
        For Each lcid As Integer In theInkRecognizer.GetLanguages()
            Dim theCultureInfo As New System.Globalization.CultureInfo(lcid)
            result.AppendLine(String.Format( _
                "      0x{0:x4}: {1}", lcid, theCultureInfo.EnglishName))
        Next
    End If

    ' Add the capabilities of the recognizer.
    result.AppendLine(String.Format( _
        "   Capabilities: 0x{0:x}", theInkRecognizer.Capabilities))

    ' List each capability separately, using a helper method.
    result.Append(Me.ListCapabilities(theInkRecognizer.Capabilities))

    ' Add the properties the recognizer supports.
    result.AppendLine("   Supports the following properties:")
    If (0 = theInkRecognizer.GetSupportedProperties().Length) Then
        result.AppendLine("      No properties supported.")
    Else
        For Each theGuid As System.Guid In theInkRecognizer.GetSupportedProperties()
            ' Use the helper method to get the name of the property.
            result.AppendLine("      " + Me.GetPropertyName(theGuid))
        Next
    End If

    Return result.ToString()
End Function
        /// <summary>
        /// Generates a string containing information about the specified InkRecognizer.
        /// </summary>
        /// <param name="theInkRecognizer">
        /// The InkRecognizer from which to gather the information.
        /// </param>
        /// <returns>
        /// A string containing information about the specified InkRecognizer.
        /// </returns>
        private string GetInkRecognizerData(
            Microsoft.Ink.InkRecognizer theInkRecognizer)
        {
            // Create a StringBuilder in which to collect the information.
            System.Text.StringBuilder result = new System.Text.StringBuilder();

            // Add the name of the recognizer.
            result.AppendLine(string.Format(
                "Name: {0}", theInkRecognizer.Name));

            // Add the GUID of the recognizer.
            result.AppendLine(string.Format(
                "   Guid: {0}", theInkRecognizer.Guid));

            // Add the vendor of the recognizer.
            result.AppendLine(string.Format(
                "   Vendor: {0}", theInkRecognizer.Vendor));

            // Add the languages the recognizer supports.
            result.AppendLine("   Supports the following languages:");
            if (0 == theInkRecognizer.GetLanguages().Length)
            {
                result.AppendLine("      No languages supported.");
            }
            else
            {
                foreach (int lcid in theInkRecognizer.GetLanguages())
                {
                    System.Globalization.CultureInfo theCultureInfo =
                        new System.Globalization.CultureInfo(lcid);
                    result.AppendLine(string.Format(
                        "      0x{0:x4}: {1}", lcid, theCultureInfo.EnglishName));
                }
            }

            // Add the capabilities of the recognizer.
            result.AppendLine(string.Format(
                "   Capabilities: 0x{0:x}", theInkRecognizer.Capabilities));

            // List each capability separately, using a helper method.
            result.Append(this.ListCapabilities(theInkRecognizer.Capabilities));

            // Add the properties the recognizer supports.
            result.AppendLine("   Supports the following properties:");
            if (0 == theInkRecognizer.GetSupportedProperties().Length)
            {
                result.AppendLine("      No properties supported.");
            }
            else
            {
                foreach (System.Guid theGuid in theInkRecognizer.GetSupportedProperties())
                {
                    // Use the helper method to get the name of the property.
                    result.AppendLine("      " + this.GetPropertyName(theGuid));
                }
            }

            return result.ToString();
        }

Hiérarchie d'héritage

System.Object
  Microsoft.Ink.InkRecognizer

Sécurité des threads

Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

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

Membres InkRecognizer

Microsoft.Ink, espace de noms

Microsoft.Ink.InkRecognizerCollection

Microsoft.Ink.InkAnalyzer

Microsoft.Ink.AnalysisHintNode