Condividi tramite


Proprietà TextWordNode.Data

Aggiornamento: novembre 2007

Ottiene e imposta i dati definiti dall'applicazione per l'oggetto TextWordNode.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Sintassi

'Dichiarazione
Public Property Data As Object
'Utilizzo
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)

Valore proprietà

Tipo: System.Object
Dati definiti dall'applicazione per l'oggetto TextWordNode.

Note

Utilizzarlo per aggiungere i propri dati all'oggetto TextWordNode.

Esempi

Nell'esempio seguente viene aggiunto un oggetto TextWordNode a un oggetto InkAnalyzer, theInkAnalyzer, per un controllo TextBox, theTextBox. Viene convertita la posizione del controllo TextBox da coordinate pixel a coordinate di input penna. Viene inoltre impostata la proprietà Data dell'oggetto TextWordNode come proprietà Text del controllo TextBox.

' 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;

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

TextWordNode Classe

Membri TextWordNode

Spazio dei nomi Microsoft.Ink