TextWordNode 类

表示应用程序中可以存在非墨迹文本单词的二维区域的 ContextNode

命名空间:  System.Windows.Ink
程序集:  IAWinFX(在 IAWinFX.dll 中)

语法

声明
Public NotInheritable Class TextWordNode _
    Inherits ContextNode
用法
Dim instance As TextWordNode
public sealed class TextWordNode : ContextNode
public ref class TextWordNode sealed : public ContextNode
public final class TextWordNode extends ContextNode
public final class TextWordNode extends ContextNode

备注

InkAnalyzer 不生成 TextWordNode 对象。应用程序使用 CreateSubNode(ContextNodeType) 方法将 TextWordNode 对象添加到上下文节点树。如果保存分析器的状态,则这些节点也可保存。

未来的识别器可能使用由 TextWordNode 对象定义的区域来确定是否有任何墨迹对非墨迹单词进行批注。

TextWordNode 不能有任何子节点。

示例

下面的示例为名为 theTextBox 的 TextBox 控件将一个 TextWordNode 对象添加到名为 theInkAnalyzer 的 InkAnalyzer。该示例将 TextWordNode 对象的 Data 属性设置为 TextBoxText 属性。

' Add nodes to hold the TextWordNode
Dim writingRegion As WritingRegionNode = _
    CType(theInkAnalyzer.RootNode.CreateSubNode(ContextNodeType.WritingRegion), _
    WritingRegionNode)

Dim paragraph As ParagraphNode = _
    CType(writingRegion.CreateSubNode(ContextNodeType.Paragraph), _
    ParagraphNode)

Dim line As LineNode = _
    CType(paragraph.CreateSubNode(ContextNodeType.Line), LineNode)

' Create node for the word
Dim textWord As TextWordNode = _
    CType(line.CreateSubNode(ContextNodeType.TextWord), TextWordNode)

' Set location
Dim textTop As Double = InkCanvas.GetTop(theTextBox)
Dim textLeft As Double = InkCanvas.GetLeft(theTextBox)

Dim rectLocation As New Rect(textLeft, textTop, theTextBox.Width, theTextBox.Height)
textWord.SetLocation(New AnalysisRegion(rectLocation))

' Set the data property to be the text in the textbox.
textWord.Data = theTextBox.Text

// Add nodes to hold the TextWordNode
WritingRegionNode writingRegion = (WritingRegionNode)
    theInkAnalyzer.RootNode.CreateSubNode(ContextNodeType.WritingRegion);
ParagraphNode paragraph = (ParagraphNode)
    writingRegion.CreateSubNode(ContextNodeType.Paragraph);
LineNode line = (LineNode)
    paragraph.CreateSubNode(ContextNodeType.Line);

// Create node for the word
TextWordNode textWord = (TextWordNode)
    line.CreateSubNode(ContextNodeType.TextWord);


// Set location
double textTop = InkCanvas.GetTop(theTextBox);
double textLeft = InkCanvas.GetLeft(theTextBox);

Rect rectLocation = new Rect(textLeft, textTop, theTextBox.Width, theTextBox.Height);
textWord.SetLocation(new AnalysisRegion(rectLocation));

// Set the data property to be the text in the textbox.
textWord.Data = theTextBox.Text;

继承层次结构

System.Object
  System.Windows.Ink.ContextNode
    System.Windows.Ink.TextWordNode

线程安全

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

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

TextWordNode 成员

System.Windows.Ink 命名空间

System.Windows.Ink.InkWordNode

System.Windows.Ink.ImageNode