ContextNode.DeleteSubNode, méthode
Mise à jour : November 2007
Supprime un objet ContextNode enfant.
Espace de noms : Microsoft.Ink
Assembly : Microsoft.Ink.Analysis (dans Microsoft.Ink.Analysis.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 : Microsoft.Ink.ContextNode
ContextNode à supprimer.
Notes
L'exception ArgumentException (page pouvant être en anglais) 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 utilise les lignes d'un InkAnalyzer. 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(Microsoft.Ink.ContextNodeType.Paragraph)
Dim lines As ContextNodeCollection = _
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line)
Dim lineNode As ContextNode
For Each lineNode In lines
' Create a new alignment level and paragraph
Dim lineParagraph As ContextNode = lineNode.ParentNode
Dim writingRegion As ContextNode = lineParagraph.ParentNode
Dim newParagraph As ParagraphNode = _
CType(writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph), ParagraphNode)
' Reparent the line
lineNode.Reparent(newParagraph)
Next lineNode
' Remove original paragraphs and alignment nodes
Dim originalParagraph As ContextNode
For Each originalParagraph In originalParagraphs
Dim originalAlignmentLevel As ContextNode = originalParagraph.ParentNode
originalAlignmentLevel.DeleteSubNode(originalParagraph)
originalAlignmentLevel.ParentNode.DeleteSubNode(originalAlignmentLevel)
Next originalParagraph
// Take each line and make it its own paragraph
ContextNodeCollection originalParagraphs =
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Paragraph);
ContextNodeCollection lines =
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line);
foreach (ContextNode lineNode in lines)
{
// Create a new paragraph
ContextNode paragraph = lineNode.ParentNode;
ContextNode writingRegion = paragraph.ParentNode;
ParagraphNode newParagraph = (ParagraphNode)
writingRegion.CreateSubNode(Microsoft.Ink.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