Compartir a través de


InkWordNode.GetRecognizedString Method

Returns the best-result string of the recognition operation for the InkWordNode.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)

Syntax

'Declaration
Public Function GetRecognizedString As String
'Usage
Dim instance As InkWordNode
Dim returnValue As String

returnValue = instance.GetRecognizedString
public string GetRecognizedString ()
public:
String^ GetRecognizedString ()
public String GetRecognizedString ()
public function GetRecognizedString () : String
Not applicable.

Return Value

Returns the best-result string of the recognition operation for the InkWordNode.

Example

The following example is a method that recursively traverses a tree of ContextNode objects and populates a TreeViewTreeView by adding TreeNodeTreeNode objects and setting their TreeNode.TextTreeNode.Text property to GetRecognizedString.

Private Sub WalkTree(ByVal parentContextNode As Microsoft.Ink.ContextNode, _
                     ByVal parentTreeNode As TreeNode)

    Dim cNode As ContextNode
    For Each cNode In parentContextNode.SubNodes
        Dim newTNode As New TreeNode(cNode.ToString())
        If TypeOf cNode Is Microsoft.Ink.InkWordNode Then
            newTNode.Text = newTNode.Text + _
                ": " + CType(cNode, InkWordNode).GetRecognizedString()
        ElseIf TypeOf cNode Is Microsoft.Ink.InkDrawingNode Then
            Dim shapeName As String = CType(cNode, InkDrawingNode).GetShapeName()
            If shapeName <> "" Then
                newTNode.Text = newTNode.Text + ": " + shapeName
            End If
        End If
        WalkTree(cNode, newTNode)
        parentTreeNode.Nodes.Add(newTNode)

        ' Add the context node as a tag of the tree node
        newTNode.Tag = cNode
    Next cNode

End Sub 'WalkTree
private void WalkTree(
    Microsoft.Ink.ContextNode parentContextNode, TreeNode parentTreeNode)
{
    foreach (ContextNode cNode in parentContextNode.SubNodes)
    {
        TreeNode newTNode = new TreeNode(cNode.ToString());
        if (cNode is Microsoft.Ink.InkWordNode)
        {
            newTNode.Text +=
                ": " + ((InkWordNode)cNode).GetRecognizedString();
        }
        else if (cNode is Microsoft.Ink.InkDrawingNode)
        {
            String shapeName = ((InkDrawingNode)cNode).GetShapeName();
            if (shapeName != "")
                newTNode.Text += ": " + shapeName;
        }
        WalkTree(cNode, newTNode);
        parentTreeNode.Nodes.Add(newTNode);

        // Add the context node as a tag of the tree node
        newTNode.Tag = cNode;
    }
}

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkWordNode Class
InkWordNode Members
Microsoft.Ink Namespace
InkWordNode.SetRecognizedString