次の方法で共有


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 void ReparentStrokes (
    StrokeCollection strokes, 
    ContextNode destinationNode
)
public function ReparentStrokes (
    strokes : StrokeCollection, 
    destinationNode : ContextNode
)
Not applicable.

Parameters

  • destinationNode
    The ContextNode object that the stroke should be moved to.

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.

Example

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 = 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 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

ContextNode Class
ContextNode Members
System.Windows.Ink Namespace