在form_load中激发treeview的第一个节点的click事件

解决方案 »

  1.   

    哦,你是说选中最上面一个吧,这样
    this.treeView1.SelectedNode=this.treeView1.Nodes[0];
      

  2.   

    treeView1.SelectedNode=this.treeView1.Nodes[0];
      

  3.   

    呵呵,已经解决问题,请看
    /// <summary>
    /// 展开所有的节点
    /// </summary>
    public void ExpandAll()
    {
    try
    {
    this.treeView1.ExpandAll(); 
    if(this.treeView1.Nodes.Count>0)
    { this.treeView1.SelectedNode=this.treeView1.Nodes[this.treeView1.Nodes.Count-1];
    this.treeView1.Select(); this.treeView1.SelectedNode=this.treeView1.Nodes[0];
    this.treeView1.Select();
    }
    }
    catch{}
    }
      

  4.   

    我的情况是这样,首先用this.treeView1.ExpandAll(); 展开所有的节点,(我的节点是动态加载的)
    然后,定位到最后一个,在定位的第一个,这样滚动条就自动滚动到最上边了,如果不先定位到第一个,虽然选中了第一个,但是滚动条不滚动