InkRecognizer 类
提供对 InkAnalyzer 所使用的手写识别器的访问。
命名空间: System.Windows.Ink
程序集: IAWinFX(在 IAWinFX.dll 中)
语法
声明
Public Class InkRecognizer _
Implements IDisposable
用法
Dim instance As InkRecognizer
public class InkRecognizer : IDisposable
public ref class InkRecognizer : IDisposable
public class InkRecognizer implements IDisposable
public class InkRecognizer implements IDisposable
备注
识别器具有可执行识别的特定属性 (Attribute) 和属性 (Property)。必须先确定识别器的属性,然后才能进行识别。识别器支持的属性的类型决定了它可以执行的识别的类型。例如,如果识别器不支持连体手写,它在用户连体书写时将返回不准确的结果。
识别器还有一些内置功能,可以自动管理手写内容的许多方面。例如,识别器可以确定笔画书写行的规格。正是由于识别器的这种内置功能,您可以返回笔画的行号,但无需指定如何确定行规格。
InkAnalyzer 维护一个由可用识别器组成的 InkRecognizerCollection。若要访问该集合,请使用 InkAnalyzer 的 GetInkRecognizersByPriority 方法。
示例
下面的示例定义一个返回字符串的方法。该字符串包含有关指定的 InkRecognizer 的信息。该示例中没有演示帮助器方法 ListCapabilities,该方法使用反射返回有关 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();
}
继承层次结构
System.Object
System.Windows.Ink.InkRecognizer
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0
另请参见
参考
System.Windows.Ink.InkRecognizerCollection