ContextNode.Reparent Method
Removes this ContextNode from its current parent and adds it to another parent.
Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)
Syntax
'Declaration
Public Sub Reparent ( _
newParentNode As ContextNode _
)
'Usage
Dim instance As ContextNode
Dim newParentNode As ContextNode
instance.Reparent(newParentNode)
public void Reparent (
ContextNode newParentNode
)
public:
void Reparent (
ContextNode^ newParentNode
)
public void Reparent (
ContextNode newParentNode
)
public function Reparent (
newParentNode : ContextNode
)
Not applicable.
Parameters
- newParentNode
The new parent that this ContextNode becomes a child of.
Example
This example puts all the lines into their own paragraphs. It uses the lines from an InkAnalyzer, theInkAnalyzer;
creates a new paragraph subnode for each of them; reparents the lines to those new paragraphs; and deletes the original paragraphs.
' Take each line and make it its own paragraph
Dim originalParagraphs As ContextNodeCollection = _
theInkAnalyzer.FindNodesOfType(ContextNodeType.Paragraph)
Dim lines As ContextNodeCollection = _
theInkAnalyzer.FindNodesOfType(ContextNodeType.Line)
For Each lineNode As ContextNode In lines
' Create a new paragraph
Dim paragraph As ContextNode = lineNode.ParentNode
Dim writingRegion As ContextNode = paragraph.ParentNode
Dim newParagraph As ParagraphNode = CType(writingRegion.CreateSubNode(ContextNodeType.Paragraph), ParagraphNode)
' Reparent the line
lineNode.Reparent(newParagraph)
Next lineNode
' Remove original paragraphs
For Each originalParagraph As ContextNode In originalParagraphs
Dim originalWritingRegion As ContextNode = originalParagraph.ParentNode
originalWritingRegion.DeleteSubNode(originalParagraph)
Next originalParagraph
// Take each line and make it its own paragraph
ContextNodeCollection originalParagraphs =
theInkAnalyzer.FindNodesOfType(ContextNodeType.Paragraph);
ContextNodeCollection lines =
theInkAnalyzer.FindNodesOfType(ContextNodeType.Line);
foreach (ContextNode lineNode in lines)
{
// Create a new paragraph
ContextNode paragraph = lineNode.ParentNode;
ContextNode writingRegion = paragraph.ParentNode;
ParagraphNode newParagraph = (ParagraphNode)
writingRegion.CreateSubNode(ContextNodeType.Paragraph);
// Reparent the line
lineNode.Reparent(newParagraph);
}
// Remove original paragraphs
foreach (ContextNode originalParagraph in originalParagraphs)
{
ContextNode originalWritingRegion = originalParagraph.ParentNode;
originalWritingRegion.DeleteSubNode(originalParagraph);
}
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