TextWordNode.Data 属性
获取或设置 TextWordNode 对象的应用程序定义的数据。
命名空间: System.Windows.Ink
程序集: IAWinFX(在 IAWinFX.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 对象。
示例
下面的示例为名为 theTextBox 的 TextBox 控件将一个 TextWordNode 对象添加到名为 theInkAnalyzer 的 InkAnalyzer。该示例将 TextWordNode 对象的 Data 属性设置为 TextBox 的 Text 属性。
' 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;
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0