Compartir a través de


InkAnalyzer.InkAnalyzer Constructor

Initializes a new instance of the InkAnalyzer class associated with the specified Microsoft.Ink.Ink object.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)

Syntax

'Declaration
Public Sub New ( _
    ink As Ink, _
    synchronizingObject As ISynchronizeInvoke _
)
'Usage
Dim ink As Ink
Dim synchronizingObject As ISynchronizeInvoke

Dim instance As New InkAnalyzer(ink, synchronizingObject)
public InkAnalyzer (
    Ink ink,
    ISynchronizeInvoke synchronizingObject
)
public:
InkAnalyzer (
    Ink^ ink, 
    ISynchronizeInvoke^ synchronizingObject
)
public InkAnalyzer (
    Ink ink, 
    ISynchronizeInvoke synchronizingObject
)
public function InkAnalyzer (
    ink : Ink, 
    synchronizingObject : ISynchronizeInvoke
)
Not applicable.

Parameters

  • ink
    The Ink object from which the new InkAnalyzer receives stroke data.
  • synchronizingObject
    The control associated with the InkAnalyzer, which implements the System.ComponentModel.ISynchronizeInvoke interface.

Remarks

The InkAnalyzer can analyze stroke data from only one Ink object. You cannot change this association after the ink analyzer is initialized.

If you pass in a null value for the synchronizingObject, then you are not guaranteed thread synchronization when handling events raised by the InkAnalyzer.

Example

This example does the following.

  • Initializes a new Microsoft.Ink.Ink object, theInk.

  • Attaches an Ink.InkAdded event handler, theInk_InkAdded, to theInk.

  • Initializes a new InkAnalyzer, theInkAnalyzer, that can analyze stroke data from theInk.

' Create the Ink for use with the InkCollector and attach
' event handlers.
Me.theInk = New Microsoft.Ink.Ink()
AddHandler Me.theInk.InkAdded, AddressOf theInk_InkAdded

' Create the InkAnalyzer.
Me.theInkAnalyzer = New Microsoft.Ink.InkAnalyzer(Me.theInk, Me)
// Create the Ink for use with the InkCollector and attach
// event handlers.
this.theInk = new Microsoft.Ink.Ink();
this.theInk.InkAdded +=
    new Microsoft.Ink.StrokesEventHandler(theInk_InkAdded);

// Create the InkAnalyzer.
this.theInkAnalyzer =
    new Microsoft.Ink.InkAnalyzer(this.theInk, this);

In this example, the theInk_InkAdded event handler then takes the strokes that have been added to the theInk and adds them to theInkAnalyzer.

''' <summary>
''' The ink's InkAdded event handler.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Sub theInk_InkAdded( _
    ByVal sender As Object, ByVal e As Microsoft.Ink.StrokesEventArgs)

    ' This event handler is attached to an Ink object.
    Dim theInk As Microsoft.Ink.Ink = DirectCast(sender, Microsoft.Ink.Ink)

    ' Add the new strokes to the InkAnalyzer.
    Me.theInkAnalyzer.AddStrokes(theInk.CreateStrokes(e.StrokeIds))

End Sub 'theInk_InkAdded
/// <summary>
/// The ink's InkAdded event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInk_InkAdded(object sender, Microsoft.Ink.StrokesEventArgs e)
{
    // This event handler is attached to an Ink object.
    Microsoft.Ink.Ink theInk = sender as Microsoft.Ink.Ink;

    // Add the new strokes to the InkAnalyzer.
    this.theInkAnalyzer.AddStrokes(theInk.CreateStrokes(e.StrokeIds));
}

Platforms

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.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzer Class
InkAnalyzer Members
Microsoft.Ink Namespace
Microsoft.Ink.Ink