ContextNode.DeleteSubNode-Methode
Löscht ein untergeordnetes ContextNode-Objekt.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)
Syntax
'Declaration
Public Sub DeleteSubNode ( _
subNodeToDelete As ContextNode _
)
'Usage
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
)
Parameter
- subNodeToDelete
Typ: Microsoft.Ink.ContextNode
Der zu löschende ContextNode.
Hinweise
Eine ArgumentException wird ausgelöst, wenn subNodeToDelete kein untergeordnetes Element dieses ContextNode ist.
Beispiele
In diesem Beispiel werden alle Zeilen in eigene Absätze eingefügt. Es verwendet Zeilen aus einem InkAnalyzer mit dem Namen theInkAnalyzer, erstellt einen neuen Absatz-Unterknoten für jeden von ihnen, ordnet die Zeilen den neuen Absätzen zu und löscht die ursprünglichen Absätze.
' 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);
}
Plattformen
Windows Vista
.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
Versionsinformationen
.NET Framework
Unterstützt in: 3.0