b/s 资源管理器哪样的功能,怎么实现

解决方案 »

  1.   

     // 即将要展开一个节点时触发
            private void FirsttreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
            {
                Cursor c = this.Cursor;
                this.Cursor = Cursors.WaitCursor;
                try
                {                for (int i = 0; i < e.Node.Nodes.Count; i++)
                    {
                        DirectoryInfo arr = new DirectoryInfo(e.Node.Nodes[i].FullPath);
                        DirectoryInfo[] arrs = null;
                        try
                        {
                            arrs = arr.GetDirectories();
                        }
                        catch
                        {
                            continue;
                        }
                            for (int j = 0; j < arrs.Length; j++)
                        {
                            e.Node.Nodes[i].Nodes.Add(arrs[j].Name);
                            e.Node.Nodes[i].Nodes[j].ImageIndex = 1;
                            e.Node.Nodes[i].Nodes[j].SelectedImageIndex = 2;
                        }
                        
                    }
                }
                finally
                { 
                    this.Cursor=c; 
                }
            }