Поделиться через


InkRecognizerBase - класс

Обновлен: Ноябрь 2007

Provides access to handwriting recognizers for use with ink analysis.

Пространство имен:  System.Windows.Ink.AnalysisCore
Сборка:  IACore (в IACore.dll)

Синтаксис

'Декларация
Public Class InkRecognizerBase _
    Implements IDisposable
'Применение
Dim instance As InkRecognizerBase
public class InkRecognizerBase : IDisposable
public ref class InkRecognizerBase : IDisposable
public class InkRecognizerBase implements IDisposable
public class InkRecognizerBase implements IDisposable

Заметки

A recognizer has specific attributes and properties that allow it to perform recognition. The properties of a recognizer must be determined before recognition can occur. The types of properties that a recognizer supports determine the types of recognition that it can perform. For instance, if a recognizer does not support cursive handwriting, it returns inaccurate results when a user writes in cursive.

A recognizer also has built-in functionality that automatically manages many aspects of handwriting. For instance, it determines the metrics for the lines on which strokes are drawn. You can return the line number of a stroke, but you never need to specify how those line metrics are determined because of the built-in functionality of the recognizer.

The InkAnalyzerBase maintains a InkRecognizerBaseCollection of available recognizers. To access this collection, use the GetInkRecognizersByPriority method of the InkAnalyzerBase.

Примеры

The following example defines a method that returns a string containing information about a specified InkRecognizerBase. Not shown in this example are the helper methods ListCapabilities and GetPropertyName, which use reflection to return information about specific capabilities and properties of the InkRecognizerBase.

''' <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 System.Windows.Ink.AnalysisCore.InkRecognizerBase) 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(
            System.Windows.Ink.AnalysisCore.InkRecognizerBase 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();
        }

Иерархия наследования

System.Object
  System.Windows.Ink.AnalysisCore.InkRecognizerBase

Потокобезопасность

Любые открытые члены этого типа, объявленные как static (Shared в Visual Basic), являются потокобезопасными. Потокобезопасность членов экземпляров не гарантируется.

Платформы

Windows Vista, Windows XP с пакетом обновления 2 (SP2), Windows Server 2003

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

InkRecognizerBase - члены

System.Windows.Ink.AnalysisCore - пространство имен

System.Windows.Ink.AnalysisCore.InkRecognizerBaseCollection

Microsoft.Ink.InkAnalyzer

System.Windows.Ink.AnalysisHintNode

System.Windows.Ink.AnalysisCore.PropertyGuidsForAnalysisHintsBase