InkAnalyzer Class
Assembly: IAWinFX (in iawinfx.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
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 is the region for which strokes 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 upon which the InkAnalyzer raises events 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 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 to set which ink recognizer handles strokes of that 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
-
GetTextRangeFromNodes
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 has been 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, theInkCanvas.
theInkAnalyzer = New InkAnalyzer() AddHandler theInkCanvas.Strokes.StrokesChanged, AddressOf Strokes_StrokesChanged
The following example defines the Strokes_StrokesChanged event handler, which adds the strokes that have been added to theInkCanvas to theInkAnalyzer and removes the strokes that have been removed from theInkCanvas from theInkAnalyzer.
' 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
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.