Share via


ContextNode.ReparentStrokes Method

Moves a stroke from this ContextNode object to the specified ContextNode object.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public Sub ReparentStrokes ( _
    strokes As Strokes, _
    destinationNode As ContextNode _
)
'Usage
Dim instance As ContextNode 
Dim strokes As Strokes 
Dim destinationNode As ContextNode

instance.ReparentStrokes(strokes, destinationNode)
public void ReparentStrokes(
    Strokes strokes,
    ContextNode destinationNode
)
public:
void ReparentStrokes(
    Strokes^ strokes, 
    ContextNode^ destinationNode
)
public function ReparentStrokes(
    strokes : Strokes, 
    destinationNode : ContextNode
)

Parameters

Remarks

The specified ContextNode must be one of the following classes: InkWordNode, InkDrawingNode, InkBulletNode or UnclassifiedInkNode. Attempting to move a stroke to any other type of ContextNode results in an ArgumentException.

This method can be called from any ContextNode object, including non-ink leaf ContextNode objects. The specified stroke must be referenced by one of the descendants of this ContextNode object or an ArgumentException is raised.

If either the ContextNode object or the destinationNode is confirmed, an exception is raised.

Examples

The following example uses a ContextNodeCollection, inkDrawingsToCombine that consists of a collection of InkDrawingNode objects. The example combines them into one InkDrawingNode object by using the ReparentStrokes method.

Dim firstNode As InkDrawingNode = CType(inkDrawingsToCombine(0), InkDrawingNode)
Dim drawingNode As InkDrawingNode
For Each drawingNode In inkDrawingsToCombine
    ' Skip first stroke 
    If drawingNode.Equals(firstNode) Then Continue For 

    ' Reparent all strokes to the first node
    drawingNode.ReparentStrokes(drawingNode.Strokes, firstNode)

    ' Delete this node
    drawingNode.ParentNode.DeleteSubNode(drawingNode)
Next
            InkDrawingNode firstNode = (InkDrawingNode) inkDrawingsToCombine[0];
            foreach (InkDrawingNode drawingNode in inkDrawingsToCombine)
            {
                // Skip first stroke 
                if (drawingNode == firstNode)
                    continue;

                // Reparent all strokes to the first node
                drawingNode.ReparentStrokes(drawingNode.Strokes, firstNode);

                // Delete this node
                drawingNode.ParentNode.DeleteSubNode(drawingNode);
            }

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

See Also

Reference

ContextNode Class

ContextNode Members

Microsoft.Ink Namespace