ContextNodeBase.Reparent Method
Removes this ContextNodeBase object from its current parent and adds it to another parent.
Namespace: System.Windows.Ink.AnalysisCore
Assembly: IACore (in iacore.dll)
Syntax
'Declaration
Public Sub Reparent ( _
newParentNode As ContextNodeBase _
)
'Usage
Dim instance As ContextNodeBase
Dim newParentNode As ContextNodeBase
instance.Reparent(newParentNode)
public void Reparent (
ContextNodeBase newParentNode
)
public:
void Reparent (
ContextNodeBase^ newParentNode
)
public void Reparent (
ContextNodeBase newParentNode
)
public function Reparent (
newParentNode : ContextNodeBase
)
Not applicable.
Parameters
- newParentNode
The new parent of which this ContextNodeBase object will be a child.
Example
This example takes all the ContextNodeBase objects of TypeLine and puts them into their own ContextNodeBase objects, which are of type Paragraph. It uses the lines from an InkAnalyzerBase, theInkAnalyzerBase;
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 ContextNodeBaseCollection = _
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph)
Dim lines As ContextNodeBaseCollection = _
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)
Dim lineNode As ContextNodeBase
For Each lineNode In lines
' Create a new alignment level and paragraph
Dim lineParagraph As ContextNodeBase = lineNode.ParentNode
Dim writingRegion As ContextNodeBase = lineParagraph.ParentNode
Dim newParagraph As ContextNodeBase = _
writingRegion.CreateSubNode(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph)
' Reparent the line
lineNode.Reparent(newParagraph)
Next lineNode
' Remove original paragraphs and alignment nodes
Dim originalParagraph As ContextNodeBase
For Each originalParagraph In originalParagraphs
Dim originalAlignmentLevel As ContextNodeBase = originalParagraph.ParentNode
originalAlignmentLevel.DeleteSubNode(originalParagraph)
originalAlignmentLevel.ParentNode.DeleteSubNode(originalAlignmentLevel)
Next originalParagraph
// Take each line and make it its own paragraph
ContextNodeBaseCollection originalParagraphs =
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph);
ContextNodeBaseCollection lines =
theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line);
foreach (ContextNodeBase lineNode in lines)
{
// Create a new paragraph
ContextNodeBase paragraph = lineNode.ParentNode;
ContextNodeBase writingRegion = paragraph.ParentNode;
ContextNodeBase newParagraph =
writingRegion.CreateSubNode(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Paragraph);
// Reparent the line
lineNode.Reparent(newParagraph);
}
// Remove original paragraphs
foreach (ContextNodeBase originalParagraph in originalParagraphs)
{
ContextNodeBase 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
ContextNodeBase Class
ContextNodeBase Members
System.Windows.Ink.AnalysisCore Namespace