Share via


TextWordNode (Clase)

Actualización: noviembre 2007

Representa un objeto ContextNode de una región bidimensional en la que pueden existir palabras de texto no manuscritas en la aplicación.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink.Analysis (en Microsoft.Ink.Analysis.dll)

Sintaxis

'Declaración
Public NotInheritable Class TextWordNode _
    Inherits ContextNode
'Uso
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

Comentarios

El objeto InkAnalyzer no genera objetos TextWordNode. La aplicación utiliza el método ContextNode.CreateSubNode para agregar los objetos TextWordNode al árbol de nodos de contexto. Si se conserva el estado del analizador, estos nodos también pueden conservarse.

Los reconocedores futuros pueden utilizar las regiones definidas por los objetos TextWordNode para determinar si alguna entrada manuscrita anota la palabra no manuscrita.

Un objeto TextWordNode no puede tener ningún elemento secundario.

Ejemplos

En el ejemplo siguiente, se agrega un objeto TextWordNode a un objeto InkAnalyzer, theInkAnalyzer, para un control TextBox, theTextBox. Convierte la ubicación del control TextBox de coordenadas en píxeles a coordenadas de entrada manuscrita. Establece la propiedad Data del objeto TextWordNode de manera que sea la propiedad Text de 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;

Jerarquía de herencia

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

Seguridad para subprocesos

Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

TextWordNode (Miembros)

Microsoft.Ink (Espacio de nombres)

Microsoft.Ink.InkWordNode

Microsoft.Ink.ImageNode