共用方式為


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 屬性設定為 TextBox (英文) 的 Text (英文) 屬性。

' 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

執行緒安全

這個型別的任何 Public 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