Freigeben über


InkRecognizer-Klasse

Bietet Zugriff auf Handschrifterkennungsmodule, die zur Freihandanalyse verwendet werden sollen.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public Class InkRecognizer _
    Implements IDisposable
'Usage
Dim instance As InkRecognizer
public class InkRecognizer : IDisposable
public ref class InkRecognizer : IDisposable
public class InkRecognizer implements IDisposable
public class InkRecognizer implements IDisposable

Hinweise

Ein Erkennungsmodul weist spezifische Attribute und Eigenschaften auf, die den Erkennungsvorgang ermöglichen. Bevor eine Erkennung erfolgen kann, müssen die Eigenschaften des Erkennungsmoduls bestimmt werden. Die von einem Erkennungsmodul unterstützten Eigenschaftentypen bestimmen, welche Arten von Erkennung es ausführen kann. Wenn ein Erkennungsmodul beispielsweise keine kursive Handschrift unterstützt, werden bei der Eingabe von Kursivschrift ungenaue Ergebnisse zurückgegeben.

Ein Erkennungsmodul verfügt außerdem über integrierte Funktionen, mit denen viele Aspekte der Handschrifteingabe automatisch verwaltet werden. Beispielsweise wird die Metrik für die Zeilen bestimmt, auf denen Striche gezeichnet werden. Sie können die Zeilennummer eines Strichs zurückgeben, aufgrund der integrierten Funktionalität des Erkennungsmoduls müssen Sie jedoch niemals angeben, wie diese Zeilenmetriken bestimmt werden.

Das InkAnalyzer-Objekt verwaltet eine InkRecognizerCollection-Auflistung der verfügbare Erkennungsmodule. Greifen Sie mit der GetInkRecognizersByPriority-Methode auf diese Auflistung zu.

Beispiele

Im folgenden Beispiel wird eine Methode definiert, die eine Zeichenfolge mit Informationen über das angegebene InkRecognizer zurückgibt. In diesem Beispiel werden die Hilfsmethoden ListCapabilities und GetPropertyName nicht dargestellt, die mithilfe der Reflexion Informationen zu bestimmten Funktionen und Eigenschaften des InkRecognizer zurückgeben.

''' <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();
        }

Vererbungshierarchie

System.Object
  Microsoft.Ink.InkRecognizer

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic)-Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows Vista

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

Versionsinformationen

.NET Framework

Unterstützt in: 3.0

Siehe auch

Referenz

InkRecognizer-Member

Microsoft.Ink-Namespace

Microsoft.Ink.InkRecognizerCollection

Microsoft.Ink.InkAnalyzer

Microsoft.Ink.AnalysisHintNode