我使用Win form treeview类。我需要有可能通过其fullpath属性导航到指定节点。即我有完整路径(“country \ region1 \ city2”)并希望自动通过此路径选择此节点。谁能帮我?
答案 0 :(得分:0)
这是msdn
的树视图导航 private void PrintRecursive(TreeNode treeNode)
{
// Print the node.
System.Diagnostics.Debug.WriteLine(treeNode.Text);
MessageBox.Show(treeNode.Text);
// Print each node recursively.
foreach (TreeNode tn in treeNode.Nodes)
{
PrintRecursive(tn);
}
}
// Call the procedure using the TreeView.
private void CallRecursive(TreeView treeView)
{
// Print each node recursively.
TreeNodeCollection nodes = treeView.Nodes;
foreach (TreeNode n in nodes)
{
PrintRecursive(n);
}
}
这也可以帮到你 codeproject variant of explorer with treeview navigation