假设你是winform设置TreeView.SelectedNode 属性
Gets or sets the tree node that is currently selected in the tree view control.Re:
If no TreeNode is currently selected, the SelectedNode property is nullNothingnullptra null reference (Nothing in Visual Basic).When you set this property, the specified node is scrolled into view and any parent nodes are expanded so that the specified node is visible.When the parent node or any ancestor node of the selected node is collapsed either programmatically or through user action, the collapsed node becomes the selected node.

解决方案 »

  1.   

    遍历节点,判断选中状态,再选中
    http://www.cnblogs.com/CampagniaTe/archive/2008/02/26/837309.html
      

  2.   

     private void Form1_Load(object sender, EventArgs e)
            {
                TreeNode root = tv1.Nodes.Add("00", "root");
                TreeNode nodeA = root.Nodes.Add("01", "a");
                root.Nodes.Add("02", "b");
                tv1.CheckBoxes = true;
                nodeA.Checked = true;
                tv1.ExpandAll();
            }        private void button1_Click(object sender, EventArgs e)
            {
                TreeNode[] nodes =tv1.Nodes.Find("01", true);//true,搜索所有节点
                if (nodes.Length > 0)
                {
                    nodes[0].Checked = true;
                }
                nodes = tv1.Nodes.Find("02", true);
                if (nodes.Length > 0)
                {
                    nodes[0].Checked = false;
                }
            }
      

  3.   

    button1:
       treeView1.SelectedNode=treeView1.Nodes[0];
    button2:
       treeView1.SelectedNode=treeView1.Nodes[1];