共用方式為


InkRecognizerBase 類別

提供對用來分析筆墨之手寫辨識器的存取。

命名空間:  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

備註

辨識器有用來執行辨識的特定屬性 (Attribute) 和屬性 (Property)。辨識器的屬性必須在辨識發生之前決定。辨識器支援的屬性類型決定了它可以執行的辨識類型。例如,如果辨識器不支援草寫的手寫輸入,當使用者使用草寫時,它會傳回不正確的結果。

辨識器也有自動管理手寫輸入許多層面的內建功能。例如,它會判斷繪製筆劃之行的度量資訊。您可以傳回筆劃的行號,而因為辨識器內建功能的關係,您完全不需要指定判斷這些行度量的方式。

InkAnalyzerBase 會維護可用辨識器的 InkRecognizerBaseCollection。若要存取這個集合,請使用 InkAnalyzerBaseGetInkRecognizersByPriority 方法。

範例

下列範例會定義一個方法,傳回包含所指定 InkRecognizerBase 相關資訊的字串。這個範例中未示範 Helper 方法 ListCapabilities 和 GetPropertyName,這些 Helper 方法會使用反映 (Reflection) 傳回 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

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

平台

Windows Vista, Windows XP 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