代码在这里看看吧,

关键的代码是这个Expand()方法,要展开那个就在那个节点后面Expand()方法一下就可以了


            {
                treeView1.Nodes["Gtr_attendance"].Expand();
                
//展开子节点              
                treeView1.Nodes["Gtr_attendance"].Nodes["tr_attendance"].Expand();
                
//展开子节点                
                treeView1.Nodes["Gtr_attendance"].Nodes["tr_staff"].Expand();
            }
            
catch (Exception ex)
            {
                lblMessages.Text 
= ex.Message.ToString().Trim();
            }

 还可以这样

在绑定的时候,在你要展开的节点,将属性EXpanded=true;

这个属性就是是否展开的意思。

 

相关文章: