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 对象可包含下列类型的子元素:

示例

下面的示例取用某 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

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

ParagraphNode 成员

Microsoft.Ink 命名空间