ContextNode.Reparent, méthode
Mise à jour : November 2007
Supprime ce ContextNode de son parent actuel et l'ajoute à un autre parent.
Espace de noms : System.Windows.Ink
Assembly : IAWinFX (dans IAWinFX.dll)
Syntaxe
'Déclaration
Public Sub Reparent ( _
newParentNode As ContextNode _
)
'Utilisation
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
)
Paramètres
- newParentNode
Type : System.Windows.Ink.ContextNode
Nouveau parent dont ce ContextNode devient un enfant.
Exemples
Cet exemple place toutes les lignes dans leurs paragraphes respectifs. Il utilise les lignes d'un InkAnalyzer nommé theInkAnalyzer;, crée un sous-nœud de paragraphe pour chacun d'eux et assigne les lignes à ces nouveaux paragraphes avant de supprimer les paragraphes d'origine.
' 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);
}
Plateformes
Windows Vista
Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Informations de version
.NET Framework
Pris en charge dans : 3.0