Share via


ContextNode.ReparentStrokes Method

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

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

Syntax

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

instance.ReparentStrokes(strokes, destinationNode)
public void ReparentStrokes(
    StrokeCollection strokes,
    ContextNode destinationNode
)
public:
void ReparentStrokes(
    StrokeCollection^ strokes, 
    ContextNode^ destinationNode
)
public function ReparentStrokes(
    strokes : StrokeCollection, 
    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 will result 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; otherwise, 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 named 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 = firstNode Then
        GoTo ContinueForEach1
    End If  
    ' Reparent all strokes to the first node
    drawingNode.ReparentStrokes(drawingNode.Strokes, firstNode)

    ' Delete this node
    drawingNode.ParentNode.DeleteSubNode(drawingNode)
ContinueForEach1:
Next drawingNode
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 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

ContextNode Class

ContextNode Members

System.Windows.Ink Namespace