TextWordNode.Data 屬性
取得和設定 TextWordNode 物件的應用程式定義資料。
命名空間: Microsoft.Ink
組件: Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)
語法
'宣告
Public Property Data As Object
'用途
Dim instance As TextWordNode
Dim value As Object
value = instance.Data
instance.Data = value
public Object Data { get; set; }
public:
property Object^ Data {
Object^ get ();
void set (Object^ value);
}
/** @property */
public Object get_Data()
/** @property */
public void set_Data(Object value)
public function get Data () : Object
public function set Data (value : Object)
屬性值
型別:System.Object
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;
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0