InkAnalyzer - класс
Обновлен: Ноябрь 2007
Provides access to layout analysis, writing and drawing classification, and handwriting recognition.
Пространство имен: System.Windows.Ink
Сборка: IAWinFX (в IAWinFX.dll)
Синтаксис
'Декларация
Public Class InkAnalyzer _
Implements IDisposable
'Применение
Dim instance As InkAnalyzer
public class InkAnalyzer : IDisposable
public ref class InkAnalyzer : IDisposable
public class InkAnalyzer implements IDisposable
public class InkAnalyzer implements IDisposable
Заметки
To add or remove strokes to the InkAnalyzer for analysis, use the AddStroke, AddStrokes, RemoveStroke(), or RemoveStrokes() methods. These methods update the DirtyRegion property, which defines the region that contains the strokes that are analyzed in the next analysis operation.
To analyze ink, use the Analyze or BackgroundAnalyze() method. During analysis, the InkAnalyzer performs layout analysis, stroke classification, and handwriting recognition.
During analysis, the InkAnalyzer raises a number of events. Set the SynchronizingObject property to specify the thread where the InkAnalyzer will raise the events that are generated during background analysis. Many InkAnalyzer events support the data proxy features of the InkAnalyzer. For more information, see Data Proxy with Ink Analysis.
To stop the analysis process from within an event handler, call the Abort method.
To modify the language that the ink analyzer uses to recognize handwriting, use SetStrokeLanguageId() or SetStrokesLanguageId(). To modify how the ink analyzer classifies specific strokes, use SetStrokeType() or SetStrokesType().
The InkAnalyzer loads all of the installed ink recognizers. The InkRecognizersByPriority() property gets an InkRecognizerCollection containing each InkRecognizer available. If more than one ink recognizer supports a specific language, use SetHighestPriorityInkRecognizer(InkRecognizer) to designate the ink recognizer that is responsible for handling strokes for a given language.
For information about providing context for the ink analysis operation, see CreateAnalysisHint, DeleteAnalysisHint(), and GetAnalysisHints.
The ink analyzer represents analysis results as a string or as a tree of ContextNode objects. To access the recognized string, use GetRecognizedString(). To access the root of the tree, use the RootNode property. The ink analyzer has the following methods for finding specific context nodes or text.
GetNodesFromTextRange(Int32%, Int32%)
GetTextRangeFromNodes(ContextNodeBaseCollection, Int32%, Int32%)
To work with alternate analysis results, use GetAlternates and ModifyTopAlternate.
To save analysis results, use SaveResults. To load saved results, use Load.
For more information about using the InkAnalyzer to analyze ink, see Ink Analysis Overview.
You must explicitly call the Dispose method on any InkAnalyzer object to which an event handler is attached, before the object goes out of scope
Примеры
The following example creates a new InkAnalyzer and attaches the StrokesChanged event handler to the Strokes property on the InkCanvas named theInkCanvas.
theInkAnalyzer = New InkAnalyzer()
AddHandler theInkCanvas.Strokes.StrokesChanged, AddressOf Strokes_StrokesChanged
theInkAnalyzer = new InkAnalyzer();
theInkCanvas.Strokes.StrokesChanged +=
new StrokeCollectionChangedEventHandler(Strokes_StrokesChanged);
The following example defines the Strokes_StrokesChanged event handler, which adds strokes to theInkAnalyzer if they were already added to theInkCanvas. It also removes strokes from theInkAnalyzer if they were already removed from theInkCanvas.
' This event occurs whenever a stroke is added, removed, or partially erased
' from the InkCanvas.
Sub Strokes_StrokesChanged(ByVal sender As Object, ByVal e As StrokeCollectionChangedEventArgs)
If e.Added.Count > 0 Then
theInkAnalyzer.AddStrokes(e.Added)
End If
If e.Removed.Count > 0 Then
theInkAnalyzer.RemoveStrokes(e.Removed)
End If
End Sub 'Strokes_StrokesChanged
// This event occurs whenever a stroke is added, removed, or partially erased
// from the InkCanvas.
void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
{
if (e.Added.Count > 0)
{
theInkAnalyzer.AddStrokes(e.Added);
}
if (e.Removed.Count > 0)
{
theInkAnalyzer.RemoveStrokes(e.Removed);
}
}
Иерархия наследования
System.Object
System.Windows.Ink.InkAnalyzer
Потокобезопасность
Любые открытые члены этого типа, объявленные как static (Shared в Visual Basic), являются потокобезопасными. Потокобезопасность членов экземпляров не гарантируется.
Платформы
Windows Vista
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0
См. также
Ссылки
System.Windows.Ink - пространство имен
System.Windows.Ink.AnalysisAlternate
System.Windows.Ink.AnalysisHintNode
System.Windows.Ink.AnalysisStatus