Partager via


InkWordNode, classe

Mise à jour : November 2007

Représente un ContextNode pour une collection de traits qui constituent un regroupement logique pour former un mot reconnaissable.

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

Syntaxe

'Déclaration
Public NotInheritable Class InkWordNode _
    Inherits ContextNode
'Utilisation
Dim instance As InkWordNode
public sealed class InkWordNode : ContextNode
public ref class InkWordNode sealed : public ContextNode
public final class InkWordNode extends ContextNode
public final class InkWordNode extends ContextNode

Notes

Un objet InkWordNode ne peut pas contenir d'enfants.

Exemples

L'exemple suivant parcourt en boucle tous les objets InkWordNode à partir d'un InkAnalyzer, theInkAnalyzer, puis dessine des lignes qui affichent le rectangle englobant pivoté, le jambage supérieur, la hampe inférieure, la ligne médiane et la ligne de base. Les lignes sont dessinées sur un Panel, theNotesPanel (page pouvant être en anglais).

    Dim panelGraphics As Graphics = theNotesPanel.CreateGraphics()
    Dim theRenderer As Renderer = theInkCollector.Renderer

    ' Loop through all of the ink words
    Dim inkWords As ContextNodeCollection = _
        theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord)
    Dim inkWord As InkWordNode
    For Each inkWord In inkWords
        ' Show rotated bounding box in blue
        ' Convert corners to pixel coordinates
        Dim corners As Point() = inkWord.GetRotatedBoundingBox()
        theRenderer.InkSpaceToPixel(panelGraphics, corners)
        ' Draw the rectangle
        panelGraphics.DrawPolygon(New Pen(Color.Blue), corners)

        ' Show the ascender line in green
        Dim ascenderPoints As Point() = inkWord.GetAscender()
        ' Convert to pixel coordinates
        theRenderer.InkSpaceToPixel(panelGraphics, ascenderPoints)
        panelGraphics.DrawLines(New Pen(Color.Green), ascenderPoints)

        ' Show the baseline in purple
        Dim basePoints As Point() = inkWord.GetBaseline()
        ' Convert to pixel coordinates
        theRenderer.InkSpaceToPixel(panelGraphics, basePoints)
        panelGraphics.DrawLines(New Pen(Color.Purple), basePoints)

        ' Show the descender line in yellow
        Dim descenderPoints As Point() = inkWord.GetDescender()
        ' Convert to pixel coordinates
        theRenderer.InkSpaceToPixel(panelGraphics, descenderPoints)
        panelGraphics.DrawLines(New Pen(Color.Yellow), descenderPoints)

        ' Show the mid line in brown
        Dim midlinePoints As Point() = inkWord.GetMidline()
        ' Convert to pixel coordinates
        theRenderer.InkSpaceToPixel(panelGraphics, midlinePoints)
        panelGraphics.DrawLines(New Pen(Color.Brown), midlinePoints)
    Next inkWord

    panelGraphics.Dispose()

End Sub 'inkWordMenuItem_Click
            Graphics panelGraphics = theNotesPanel.CreateGraphics();
            Renderer theRenderer = theInkCollector.Renderer;

            // Loop through all of the ink words
            ContextNodeCollection inkWords =
                theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord);
            foreach (InkWordNode inkWord in inkWords)
            {
                // Show rotated bounding box in blue
                // Convert corners to pixel coordinates
                Point[] corners = inkWord.GetRotatedBoundingBox();
                theRenderer.InkSpaceToPixel(panelGraphics, ref corners);
                // Draw the rectangle
                panelGraphics.DrawPolygon(new Pen(Color.Blue), corners);

                // Show the ascender line in green
                Point[] ascenderPoints = inkWord.GetAscender();
                // Convert to pixel coordinates
                theRenderer.InkSpaceToPixel(panelGraphics, ref ascenderPoints);
                panelGraphics.DrawLines(new Pen(Color.Green), ascenderPoints);

                // Show the baseline in purple
                Point[] basePoints = inkWord.GetBaseline();
                // Convert to pixel coordinates
                theRenderer.InkSpaceToPixel(panelGraphics, ref basePoints);
                panelGraphics.DrawLines(new Pen(Color.Purple), basePoints);

                // Show the descender line in yellow
                Point[] descenderPoints = inkWord.GetDescender();
                // Convert to pixel coordinates
                theRenderer.InkSpaceToPixel(panelGraphics, ref descenderPoints);
                panelGraphics.DrawLines(new Pen(Color.Yellow), descenderPoints);

                // Show the mid line in brown
                Point[] midlinePoints = inkWord.GetMidline();
                // Convert to pixel coordinates
                theRenderer.InkSpaceToPixel(panelGraphics, ref midlinePoints);
                panelGraphics.DrawLines(new Pen(Color.Brown), midlinePoints);
            }

            panelGraphics.Dispose();

Hiérarchie d'héritage

System.Object
  Microsoft.Ink.ContextNode
    Microsoft.Ink.InkWordNode

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 InkWordNode

Microsoft.Ink, espace de noms