InkWordNode.GetRecognizedString 方法
返回对 InkWordNode 的识别操作的最佳结果字符串。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)
语法
声明
Public Function GetRecognizedString As String
用法
Dim instance As InkWordNode
Dim returnValue As String
returnValue = instance.GetRecognizedString()
public string GetRecognizedString()
public:
String^ GetRecognizedString()
public String GetRecognizedString()
public function GetRecognizedString() : String
返回值
类型:System.String
返回对 InkWordNode 的识别操作的最佳结果字符串。
示例
下面的示例为一个方法,该方法递归遍历 ContextNode 对象的树,并通过添加 TreeNode 对象并将其 TreeNode.Text 属性设置为 GetRecognizedString 来填充 TreeView。
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(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;
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0