ContextNode.DeleteSubNode 方法
刪除子 ContextNode 物件。
命名空間: System.Windows.Ink
組件: IAWinFX (在 IAWinFX.dll 中)
語法
'宣告
Public Sub DeleteSubNode ( _
subNodeToDelete As ContextNode _
)
'用途
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
)
參數
- subNodeToDelete
型別:System.Windows.Ink.ContextNode
要刪除的 ContextNode。
備註
如果 subNodeToDelete 不是這個 ContextNode 的子系,則會擲回 ArgumentException。
範例
這個範例會將所有行放入這些行專屬的段落中。範例中會從名為 theInkAnalyzer 的 InkAnalyzer 取得每一行,並為每一行建立新的段落子節點、將這些行的父代重設為這些新段落,並且刪除原始段落。
' 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);
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0