Export (0) Print
Expand All

InkAnalyzer Class

Provides access to layout analysis, writing and drawing classification, and handwriting recognition.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public class InkAnalyzer : IDisposable
public class InkAnalyzer implements IDisposable
public class InkAnalyzer implements IDisposable
Not applicable.

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.

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();

theInkCanvas.Strokes.StrokesChanged += 
    new StrokeCollectionChangedEventHandler(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.
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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft