ParagraphNode 類別
表示 ContextNode 物件集合的 ContextNode,這些物件構成了各行的邏輯群組。
命名空間: Microsoft.Ink
組件: Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)
語法
'宣告
Public NotInheritable Class ParagraphNode _
Inherits ContextNode
'用途
Dim instance As ParagraphNode
public sealed class ParagraphNode : ContextNode
public ref class ParagraphNode sealed : public ContextNode
public final class ParagraphNode extends ContextNode
public final class ParagraphNode extends ContextNode
備註
段落的正確定義是由分析引擎所決定,但是一般來說,段落中都會包含應該重新排列在一起的行群組。
ParagraphNode 物件可以包含下列子系型別:
任何數目的 LineNode 物件。
任何數目的 InkBulletNode 物件。
範例
下列範例會取得 InkAnalyzer, theInkAnalyzer 之 ContextNode 樹狀目錄中的所有 LineNode 物件,並將它們放到自己的 ParagraphNode 物件中。
' 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);
}
繼承階層架構
System.Object
Microsoft.Ink.ContextNode
Microsoft.Ink.ParagraphNode
執行緒安全
這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0