ContextNodeBase.ToString 메서드
업데이트: 2007년 11월
ContextNodeBase 개체에 대해 사람이 인식할 수 있는 문자열 형식을 반환합니다.
네임스페이스: System.Windows.Ink.AnalysisCore
어셈블리: IACore(IACore.dll)
구문
‘선언
Public Overrides Function ToString As String
‘사용 방법
Dim instance As ContextNodeBase
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
ContextNodeBase 개체에 대한 사람이 인식할 수 있는 문자열 형식입니다.
설명
예를 들어 Type이 InkWord인 경우 이 메서드는 "InkWordNode"의 값을 반환합니다.
예제
이 예제는 ContextNodeBase 개체의 트리를 재귀적으로 이동하는 메서드입니다. 이 예제에서는 SubNodes 속성을 사용하고 TreeNode 개체를 추가하여 System.Windows.Forms.TreeView를 채웁니다. 그런 다음 개체의 Text 속성을 ToString으로 설정하여 인식된 문자열이나 모양 이름을 적절히 추가합니다.
Private Sub WalkTree(ByVal parentContextNode As ContextNodeBase, ByVal parentTreeNode As TreeNode)
Dim cNode As ContextNodeBase
For Each cNode In parentContextNode.SubNodes
Dim newTNode As New TreeNode(cNode.ToString())
If cNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord AndAlso _
cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) Then
newTNode.Text = newTNode.Text + _
": " + CType(cNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), _
String)
ElseIf cNode.Type = System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing AndAlso _
cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName) Then
Dim shapeName As String = CType(cNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName), _
String)
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(
System.Windows.Ink.AnalysisCore.ContextNodeBase parentContextNode, TreeNode parentTreeNode)
{
foreach (ContextNodeBase cNode in parentContextNode.SubNodes)
{
TreeNode newTNode = new TreeNode(cNode.ToString());
if ((cNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord) &&
cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
{
// Get the recognized string
newTNode.Text += ": " +
(string)cNode.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
}
else if ((cNode.Type == System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkDrawing) &&
cNode.ContainsPropertyData(PropertyGuidsForContextNodesBase.ShapeName))
{
newTNode.Text += ": " +
(string)cNode.GetPropertyData(PropertyGuidsForContextNodesBase.ShapeName);
}
WalkTree(cNode, newTNode);
parentTreeNode.Nodes.Add(newTNode);
// Add the context node as a tag of the tree node
newTNode.Tag = cNode;
}
}
플랫폼
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
3.0에서 지원