Compartir a través de


InkAnalyzer.AddStroke Method (Stroke, Int32)

Adds a stroke to the InkAnalyzer and assigns a specific locale identifier to the stroke.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)

Syntax

'Declaration
Public Function AddStroke ( _
    strokeToAdd As Stroke, _
    languageId As Integer _
) As ContextNode
'Usage
Dim instance As InkAnalyzer
Dim strokeToAdd As Stroke
Dim languageId As Integer
Dim returnValue As ContextNode

returnValue = instance.AddStroke(strokeToAdd, languageId)
public ContextNode AddStroke (
    Stroke strokeToAdd,
    int languageId
)
public:
ContextNode^ AddStroke (
    Stroke^ strokeToAdd, 
    int languageId
)
public ContextNode AddStroke (
    Stroke strokeToAdd, 
    int languageId
)
public function AddStroke (
    strokeToAdd : Stroke, 
    languageId : int
) : ContextNode
Not applicable.

Parameters

  • languageId
    The locale identifier to assign to strokeToAdd.

Return Value

The ContextNode to which strokeToAdd was added.

Remarks

The InkAnalyzer adds the Stroke to an UnclassifiedInkNode in the RootNode property's SubNodes collection. The Stroke, strokeToAdd, is assigned the locale identifier languageId and is added to the first UnclassifiedInkNode containing strokes with the same locale identifier. If no such UnclassifiedInkNode exists, a new UnclassifiedInkNode is created and strokeToAdd is added to the new UnclassifiedInkNode.

This method expands the DirtyRegion to the union of the region's current value and the bounding box of the added stroke.

If the stroke is already attached to the InkAnalyzer, the InkAnalyzer throws an exception.

Example

This example does the following.

  • Initializes a new System.Windows.Ink.InkCollector object, theInkCollector.

  • Attaches a System.Windows.Ink.InkCollector.Stroke event handler, theInkCollector_Stroke, to theInkCollector.

  • Initializes a new InkAnalyzer, theInkAnalyzer, that can analyze stroke data from the InkCollector object's Ink.

' Create the InkAnalyzer.
theInkAnalyzer = New InkAnalyzer()

' Attach an event handler to the InkCanvas.StrokeCollected event.
AddHandler theInkCanvas.StrokeCollected, AddressOf InkArea_StrokeCollected
// Create the InkAnalyzer.
theInkAnalyzer = new InkAnalyzer();

// Attach an event handler to the InkCanvas.StrokeCollected event.
theInkCanvas.StrokeCollected += 
    new InkCanvasStrokeCollectedEventHandler(InkArea_StrokeCollected);

In this example, the theInkCollector_Stroke event handler then takes the stroke that has been added to the theInkCollector, adds it to theInkAnalyzer, and assigns a specific locale identifier, theLanguageId, to it.

Sub InkCamvas_StrokeCollected(ByVal sender As Object, ByVal e As InkCanvasStrokeCollectedEventArgs)
    theInkAnalyzer.AddStroke(e.Stroke, Me.theLangageId)

End Sub 'InkCamvas_StrokeCollected
void InkCamvas_StrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs e)
{
    theInkAnalyzer.AddStroke(e.Stroke, this.theLangageId);
}

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
System.Windows.Ink Namespace
System.Windows.Ink.InkAnalyzer.AddStrokes
System.Windows.Ink.InkAnalyzer.RemoveStroke
System.Windows.Ink.InkAnalyzer.RemoveStrokes