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
解説
認識エンジンには、認識を実行可能にする特定の属性とプロパティがあります。認識エンジンのプロパティは、認識を行う前に決定する必要があります。認識エンジンがサポートするプロパティの種類により、実行可能な認識の種類が決まります。たとえば、認識エンジンが草書体手書きをサポートしない場合、ユーザーが草書体を書いたときに不正確な結果を返します。
認識エンジンには、手書きの多くの特徴を自動的に管理する組み込み機能もあります。たとえば、ストロークが描画される行のメトリックスが決定されます。ストロークの行番号を返すことはできますが、組み込み機能があるため、それらの行メトリックスを決定する方法を指定する必要はありません。
InkAnalyzer は、使用可能な認識エンジンの InkRecognizerCollection を保持します。このコレクションにアクセスするには、InkAnalyzer の GetInkRecognizersByPriority メソッドを使用します。
例
次の例では、文字列を返すメソッドを定義します。この文字列には、指定した InkRecognizer に関する情報が含まれます。リフレクションを使用して InkRecognizer の機能に関する情報を返すヘルパ メソッド ListCapabilities については、この例には示しません。
' <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