Share via


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 function AddStroke(
    strokeToAdd : Stroke, 
    languageId : int
) : ContextNode

Parameters

  • languageId
    Type: System.Int32

    The locale identifier assigned to strokeToAdd.

Return Value

Type: System.Windows.Ink.ContextNode
The ContextNode to which strokeToAdd is 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. The Stroke 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.

Examples

This example does the following.

  • Initializes a new InkCollector object, named theInkCollector.

  • Attaches a InkCollectorStroke event handler, named theInkCollector_Stroke, to theInkCollector.

Initializes a new InkAnalyzer, named theInkAnalyzer, that analyzes stroke data received from the InkCollector object's Ink object.

' 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 takes the stroke that was added to the theInkCollector, adds it to theInkAnalyzer, and assigns it a specific locale identifier, named theLanguageId.

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 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzer Class

InkAnalyzer Members

AddStroke Overload

System.Windows.Ink Namespace

InkAnalyzer.AddStrokes

InkAnalyzerRemoveStroke

InkAnalyzerRemoveStrokes