InkAnalyzer.AddStrokes Method (Strokes, Int32)
Adds a collection of strokes to the InkAnalyzer and assigns a specific locale identifier to each stroke.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)
Syntax
'Declaration
Public Function AddStrokes ( _
strokesToAdd As Strokes, _
languageId As Integer _
) As ContextNode
'Usage
Dim instance As InkAnalyzer
Dim strokesToAdd As Strokes
Dim languageId As Integer
Dim returnValue As ContextNode
returnValue = instance.AddStrokes(strokesToAdd, _
languageId)
public ContextNode AddStrokes(
Strokes strokesToAdd,
int languageId
)
public:
ContextNode^ AddStrokes(
Strokes^ strokesToAdd,
int languageId
)
public function AddStrokes(
strokesToAdd : Strokes,
languageId : int
) : ContextNode
Parameters
strokesToAdd
Type: Microsoft.Ink.StrokesThe Strokes to add to the InkAnalyzer.
languageId
Type: System.Int32The language identifier to assign to the strokes in the strokesToAdd collection.
Return Value
Type: Microsoft.Ink.ContextNode
The ContextNode to which strokesToAdd was added.
Remarks
The InkAnalyzer adds the Strokes to an UnclassifiedInkNode in the RootNode property's SubNodes collection. Each stroke in the Strokes collection, strokesToAdd, 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 strokes.
If any of the strokes are already attached to the InkAnalyzer, the InkAnalyzer throws an exception.
Examples
This example does the following.
Initializes a new Microsoft.Ink.Ink object, theInk.
Attaches a Ink.InkAdded event handler, theInk_InkAdded2, 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_InkAdded2 event handler then takes the strokes that have been added to the theInk, adds them to theInkAnalyzer, and assigns a specific locale identifier, theLanguageId, to them.
''' <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_InkAdded2( _
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 using a specific language identifier.
Me.theInkAnalyzer.AddStrokes( _
theInk.CreateStrokes(e.StrokeIds), Me.theLanguageId)
End Sub 'theInk_InkAdded2
/// <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_InkAdded2(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 using a specific
// language identifier.
this.theInkAnalyzer.AddStrokes(
theInk.CreateStrokes(e.StrokeIds), this.theLanguageId);
}
Platforms
Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008
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