本文整理汇总了C#中System.Windows.Forms.TreeView.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.Focus方法的具体用法?C# TreeView.Focus怎么用?C# TreeView.Focus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeView
的用法示例。
在下文中一共展示了TreeView.Focus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNodesToTree
void AddNodesToTree(TreeView tree,ServiceBusNode[] nodes)
{
string serviceNamespace = m_NamespaceTextBox.Text;
if(tree.Nodes[0].Text == "Unspecified Namespace")
{
tree.Nodes.Clear();
}
else
{
foreach(TreeNode domianNode in tree.Nodes)
{
if(domianNode.Text == serviceNamespace)
{
tree.Nodes.Remove(domianNode);
break;
}
}
}
TreeNode newNamespaceNode = new NamespaceTreeNode(this,serviceNamespace);
tree.Nodes.Add(newNamespaceNode);
tree.SelectedNode = newNamespaceNode;
tree.Focus();
foreach(ServiceBusNode node in nodes)
{
AddNode(newNamespaceNode,node);
}
}
示例2: SelectNode2Level
/// <summary>
/// 设置TreeView选中节点
/// </summary>
/// <param name="treeView"></param>
/// <param name="selectStr">选中节点文本</param>
public static void SelectNode2Level(TreeView treeView, string selectStr)
{
treeView.CollapseAll();
treeView.Visible = true;
treeView.Focus();
for (int i = 0; i < treeView.Nodes.Count; i++)
{
if (treeView.Nodes[i].Text == selectStr)
{
treeView.SelectedNode = treeView.Nodes[i];//选中
treeView.SelectedNode.Checked = true;
return;
}
for (int j = 0; j < treeView.Nodes[i].Nodes.Count; j++)
{
if (treeView.Nodes[i].Nodes[j].Text == selectStr)
{
treeView.SelectedNode = treeView.Nodes[i].Nodes[j];//选中
treeView.SelectedNode.Checked = true;
treeView.Nodes[i].Expand();//展开父级
return;
}
}
}
}
示例3: tvControllers_AfterSelect
// map this to a callback
private void tvControllers_AfterSelect(TreeView tvControllers)
{
tvControllers.invokeOnThread(
() =>
{
if (tvControllers.SelectedNode != null && tvControllers.SelectedNode.Tag != null)
{
if (tvControllers.SelectedNode.Tag is SpringMvcController)
{
showDetailsForSpringMvcController((SpringMvcController) tvControllers.SelectedNode.Tag);
}
else if (tvControllers.SelectedNode.Tag is ICirClass)
{
var cirClass = (ICirClass) tvControllers.SelectedNode.Tag;
cirFunctionDetails.viewCirClass(cirClass);
springMvcAutoBindClassesView.showClass(cirClass,springMvcMappings.cirData);
showFindingsDetailsForSpringMvcController(cirClass.Signature);
}
tvControllers.Focus();
}
});
}
开发者ID:o2platform,项目名称:O2.Platform.Projects.Misc_and_Legacy,代码行数:24,代码来源:ascx_CreateSpringMvcMappings.Controllers.cs