InkWordNode.GetRecognizedString 方法
返回对 InkWordNode 的识别的最佳结果字符串。
命名空间: System.Windows.Ink
程序集: IAWinFX(在 IAWinFX.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 对象的树,并通过添加 TreeViewItem 对象并将其 Header 属性设置为 GetRecognizedString 而填充 TreeView。
Private Shared Sub WalkTree(ByVal parentContextNode As ContextNode, ByVal parentTreeNode As TreeViewItem)
parentTreeNode.IsExpanded = True
For Each theContextSubnode As ContextNode In parentContextNode.SubNodes
Dim newTreeNode As New TreeViewItem()
newTreeNode.Header = theContextSubnode.ToString()
If TypeOf theContextSubnode Is InkWordNode Then
newTreeNode.Header += ": " + CType(theContextSubnode, InkWordNode).GetRecognizedString()
ElseIf TypeOf theContextSubnode Is InkDrawingNode Then
newTreeNode.Header += ": " + CType(theContextSubnode, InkDrawingNode).GetShapeName()
End If
' If the context node is confirmed, add a note to the
' tree view item.
If (theContextSubnode.IsConfirmed(ConfirmationType.NodeTypeAndProperties)) Then
newTreeNode.Header += " Confirmed."
End If
' Add the context node as a tag of the tree view item and
' add the new tree view item to the parent node.
newTreeNode.Tag = theContextSubnode
parentTreeNode.Items.Add(newTreeNode)
WalkTree(theContextSubnode, newTreeNode)
Next theContextSubnode
End Sub 'WalkTree
private static void WalkTree(ContextNode parentContextNode, TreeViewItem parentTreeNode)
{
// Expand the current TreeViewItem.
parentTreeNode.IsExpanded = true;
foreach (ContextNode theContextSubnode
in parentContextNode.SubNodes)
{
TreeViewItem newTreeNode = new TreeViewItem();
newTreeNode.Header = theContextSubnode.ToString();
if (theContextSubnode is InkWordNode)
{
newTreeNode.Header += ": " +
((InkWordNode)theContextSubnode).GetRecognizedString();
}
else if (theContextSubnode is InkDrawingNode)
{
newTreeNode.Header += ": " +
((InkDrawingNode)theContextSubnode).GetShapeName();
}
// If the context node is confirmed, add a note to the
// tree view item.
if (theContextSubnode.IsConfirmed(ConfirmationType.NodeTypeAndProperties))
{
newTreeNode.Header += " Confirmed.";
}
// Add the context node as a tag of the tree view item and
// add the new tree view item to the parent node.
newTreeNode.Tag = theContextSubnode;
parentTreeNode.Items.Add(newTreeNode);
WalkTree(theContextSubnode, newTreeNode);
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0