ContextNode オブジェクトの型を、ユーザーが判読できる文字列として返します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.dll 内)
構文
'宣言
Public Overrides Function ToString As String
'使用
Dim instance As ContextNode
Dim returnValue As String
returnValue = instance.ToString()
public override string ToString()
public:
virtual String^ ToString() override
public String ToString()
public override function ToString() : String
戻り値
型 : System.String
ユーザーが判読できる文字列である ContextNode オブジェクトの型。
解説
たとえば、Type が InkWord の場合、このメソッドは値 "InkWordNode" を返します。
例
この例では、ContextNode オブジェクトのツリーを再帰的に処理するメソッドを示します。SubNodes プロパティを使用し、TreeViewItem オブジェクトを追加することにより TreeView を設定します。次に、それらの Header プロパティを ToString に設定し、必要に応じて InkWordNode.GetRecognizedString または InkDrawingNode.GetShapeName を追加します。
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