TextWordNode 类

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

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.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 对象。应用程序使用 ContextNode.CreateSubNode 方法将 TextWordNode 对象添加到上下文节点树。如果保存分析器的状态,则这些节点也可保存。

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

TextWordNode 不能有任何子级。

示例

下面的示例将一个 TextWordNode 对象添加到 TextBox 控件 theTextBox 的 InkAnalyzer (theInkAnalyzer)。该示例将该 TextBox 控件的位置从像素坐标转换为墨迹坐标,并将 TextWordNode 对象的 Data 属性设置为该 TextBoxText 属性。

' Add nodes to hold the TextWordNode
Dim writingRegion As WritingRegionNode = _
        theInkAnalyzer.RootNode.CreateSubNode(Microsoft.Ink.ContextNodeType.WritingRegion)
Dim paragraph As ParagraphNode = _
    writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph)
Dim Line As LineNode = _
    paragraph.CreateSubNode(Microsoft.Ink.ContextNodeType.Line)

' Convert pixel coordinates to pixel coordinates and have the TextWordNode
' be for the entire TextBox
Dim topLeft As Point = theTextBox.Location
Dim bottomRight As New Point(theTextBox.Right, theTextBox.Bottom)
Dim thePanelGraphics As Graphics = theNotesPanel.CreateGraphics()
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, topLeft)
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, bottomRight)
thePanelGraphics.Dispose()

' Create node for the word
Dim textWord As TextWordNode = _
        Line.CreateSubNode(Microsoft.Ink.ContextNodeType.TextWord)

' Set location
Dim rectLocation As New Rectangle(topLeft, _
    New Size(bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y))
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(Microsoft.Ink.ContextNodeType.WritingRegion);
ParagraphNode paragraph = (ParagraphNode)
    writingRegion.CreateSubNode(Microsoft.Ink.ContextNodeType.Paragraph);
LineNode line = (LineNode)
    paragraph.CreateSubNode(Microsoft.Ink.ContextNodeType.Line);

// Convert pixel coordinates to pixel coordinates and have the TextWordNode
// be for the entire TextBox
Point topLeft = theTextBox.Location;
Point bottomRight = new Point(theTextBox.Right,
    theTextBox.Bottom);
Graphics thePanelGraphics = theNotesPanel.CreateGraphics();
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, ref topLeft);
theInkCollector.Renderer.PixelToInkSpace(thePanelGraphics, ref bottomRight);
thePanelGraphics.Dispose();

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

// Set location
Rectangle rectLocation = new Rectangle(topLeft,
    new Size(bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y));
textWord.SetLocation(new AnalysisRegion(rectLocation));

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

继承层次结构

System.Object
  Microsoft.Ink.ContextNode
    Microsoft.Ink.TextWordNode

线程安全

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

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

TextWordNode 成员

Microsoft.Ink 命名空间

Microsoft.Ink.InkWordNode

Microsoft.Ink.ImageNode