ContextNodeBase.DeleteSubNode, méthode
Mise à jour : November 2007
Supprime un objet ContextNodeBase enfant.
Espace de noms : System.Windows.Ink.AnalysisCore
Assembly : IACore (dans IACore.dll)
Syntaxe
'Déclaration
Public Sub DeleteSubNode ( _
node As ContextNodeBase _
)
'Utilisation
Dim instance As ContextNodeBase
Dim node As ContextNodeBase
instance.DeleteSubNode(node)
public void DeleteSubNode(
ContextNodeBase node
)
public:
void DeleteSubNode(
ContextNodeBase^ node
)
public void DeleteSubNode(
ContextNodeBase node
)
public function DeleteSubNode(
node : ContextNodeBase
)
Paramètres
- node
Type : System.Windows.Ink.AnalysisCore.ContextNodeBase
ContextNodeBase à supprimer.
Notes
Une exception est levée si le nœud n'est pas vide. L'exception ArgumentException (page pouvant être en anglais) est levée si node n'est pas un enfant de cet objet ContextNodeBase.
Exemples
Cet exemple place toutes les lignes dans leurs paragraphes respectifs. Il utilise les lignes d'un InkAnalyzerBase nommé theInkAnalyzerBase;, 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 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);
}
Plateformes
Windows Vista, Windows XP SP2, Windows Server 2003
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