0

我在更新面板中使用 Treeview。在加载树视图时,我只想扩展节点 3 个级别,即深度 = 3。我使用了 Expand Depth 属性并设置了“ExpandDepth=3”。但是扩展不起作用。感谢你的帮助。

4

1 回答 1

0

我用下面的代码修复了它。

私人无效ExpandAll(){

   foreach (TreeNode i in TreeView1.Nodes)
   {

       i.Expand();

       foreach (TreeNode f in i.ChildNodes)
       {

           f.Expand();

           foreach (TreeNode g in f.ChildNodes)
           {
               if(g.Depth==0)
               {

                   g.Expand();
               }
           }


       }
   }

}
于 2012-09-27T22:16:31.130 回答