Compartir a través de


ParagraphNode Class

Represents a ContextNode for a collection of ContextNode objects that make up a logical grouping of lines.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)

Syntax

'Declaration
Public NotInheritable Class ParagraphNode
    Inherits ContextNode
'Usage
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
Not applicable.

Remarks

The exact definition of a paragraph is determined by the analyzing engines, but in general, a paragraph contains groups of lines that should reflow together.

A ParagraphNode object can contain the following types of children:

Example

The following example takes all of the LineNode objects in the ContextNode tree of an InkAnalyzer, theInkAnalyzer, and puts them in their own ParagraphNode objects.

' 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);
}

Inheritance Hierarchy

System.Object
   Microsoft.Ink.ContextNode
    Microsoft.Ink.ParagraphNode

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ParagraphNode Members
Microsoft.Ink Namespace