ContextNode.DeleteSubNode, méthode
Mise à jour : November 2007
Supprime un objet ContextNode enfant.
Espace de noms : System.Windows.Ink
Assembly : IAWinFX (dans IAWinFX.dll)
Syntaxe
'Déclaration
Public Sub DeleteSubNode ( _
subNodeToDelete As ContextNode _
)
'Utilisation
Dim instance As ContextNode
Dim subNodeToDelete As ContextNode
instance.DeleteSubNode(subNodeToDelete)
public void DeleteSubNode(
ContextNode subNodeToDelete
)
public:
void DeleteSubNode(
ContextNode^ subNodeToDelete
)
public void DeleteSubNode(
ContextNode subNodeToDelete
)
public function DeleteSubNode(
subNodeToDelete : ContextNode
)
Paramètres
- subNodeToDelete
Type : System.Windows.Ink.ContextNode
ContextNode à supprimer.
Notes
Une exception ArgumentException est levée si subNodeToDelete n'est pas un enfant de ce ContextNode.
Exemples
Cet exemple place toutes les lignes dans leurs paragraphes respectifs. Il crée un sous-nœud de paragraphe pour chaque ligne obtenue à partir d'un InkAnalyzer nommé theInkAnalyzer, en apparentant à nouveau les lignes à ces nouveaux paragraphes et en supprimant 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