Condividi tramite


Classe InkRecognizer

Aggiornamento: novembre 2007

Fornisce l'accesso ai sistemi di riconoscimento della grafia utilizzati da InkAnalyzer.

Spazio dei nomi:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Sintassi

'Dichiarazione
Public Class InkRecognizer _
    Implements IDisposable
'Utilizzo
Dim instance As InkRecognizer
public class InkRecognizer : IDisposable
public ref class InkRecognizer : IDisposable
public class InkRecognizer implements IDisposable
public class InkRecognizer implements IDisposable

Note

Un sistema di riconoscimento dispone di attributi e proprietà specifici che consentono di eseguire l'operazione di riconoscimento. Prima di poter effettuare un'operazione di riconoscimento, è necessario definire le proprietà del riconoscimento. I tipi di proprietà supportati da un sistema di riconoscimento determinano i tipi di riconoscimento che possono essere eseguiti. Ad esempio, se un riconoscimento non supporta la grafia corsiva, restituisce risultati non accurati quando un utente scrive in corsivo.

Un sistema di riconoscimento dispone inoltre di una funzionalità incorporata in grado di gestire automaticamente molti aspetti della grafia. Ad esempio, determina la metrica per le righe in cui sono disegnati i tratti. È possibile restituire il numero di righe di un tratto, tuttavia grazie alla funzionalità incorporata non è necessario specificare il modo in cui viene determinata la metrica delle righe.

InkAnalyzer gestisce un oggetto InkRecognizerCollection di sistemi di riconoscimento disponibili. Per accedere a questo insieme, utilizzare il metodo GetInkRecognizersByPriority di InkAnalyzer.

Esempi

Nell'esempio seguente viene definito un metodo che restituisce una stringa. La stringa contiene informazioni su un oggetto InkRecognizer specificato. In questo esempio non viene illustrato il metodo di supporto ListCapabilities che utilizza la riflessione per restituire informazioni sulle funzionalità di InkRecognizer.

' <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 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
        Dim lcid As Integer
        For Each lcid In theInkRecognizer.GetLanguages()
            Dim theCultureInfo As New System.Globalization.CultureInfo(lcid)
            result.AppendLine(String.Format("      0x{0:x4}: {1}", lcid, theCultureInfo.EnglishName))
        Next lcid
    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))

    result.AppendLine(String.Format("      {0} properties supported.", _
        theInkRecognizer.GetSupportedProperties().Length.ToString()))

    Return result.ToString()

End Function 'GetInkRecognizerData

/// <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(
    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));

    result.AppendLine(string.Format("      {0} properties supported.", 
        theInkRecognizer.GetSupportedProperties().Length.ToString()));

    return result.ToString();
}

Gerarchia di ereditarietà

System.Object
  System.Windows.Ink.InkRecognizer

Codice thread safe

Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

Membri InkRecognizer

Spazio dei nomi System.Windows.Ink

System.Windows.Ink.InkRecognizerCollection

System.Windows.Ink.InkAnalyzer

System.Windows.Ink.AnalysisHintNode