Partager via


TextWordNode, classe

Mise à jour : November 2007

Représente un ContextNode pour une région à deux dimensions où tous les mots texte non manuscrits peuvent se trouver dans l'application.

Espace de noms :  Microsoft.Ink
Assembly :  Microsoft.Ink.Analysis (dans Microsoft.Ink.Analysis.dll)

Syntaxe

'Déclaration
Public NotInheritable Class TextWordNode _
    Inherits ContextNode
'Utilisation
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

Notes

Le InkAnalyzer ne produit pas d'objets TextWordNode. L'application utilise la méthode ContextNode.CreateSubNode pour ajouter les objets TextWordNode à l'arborescence des nœuds de contexte. Si l'état de l'analyseur est persistant, ces nœuds peuvent également être persistants.

Les prochains modules de reconnaissance pourront utiliser les régions définies par les objets TextWordNode pour déterminer si le mot non manuscrit est annoté par une entrée manuscrite.

Un TextWordNode ne peut pas avoir d'enfants.

Exemples

L'exemple suivant ajoute un objet TextWordNode à un InkAnalyzer, theInkAnalyzer,, pour un contrôle TextBox, theTextBox (page pouvant être en anglais). L'emplacement du contrôle TextBox (page pouvant être en anglais) est converti de coordonnées en pixels en coordonnées d'entrée manuscrite. La propriété Data de l'objet TextWordNode devient la propriété Text (page pouvant être en anglais) du TextBox (page pouvant être en anglais).

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

Hiérarchie d'héritage

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

Sécurité des threads

Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Plateformes

Windows Vista

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Framework

Pris en charge dans : 3.0

Voir aussi

Référence

Membres TextWordNode

Microsoft.Ink, espace de noms

Microsoft.Ink.InkWordNode

Microsoft.Ink.ImageNode