用C#写WIndows中的资源管理器怎么样写啊?
用C#写WIndows中的资源管理器怎么样写啊?主要是TreeNode中一个文件夹被选中,然后ListNode中就会出现相庆的子目录或文件.这一段代码不会写啊,请各位高手指教
程序代码:
/// <summary> /// 递归实现加载目录 /// </summary> /// <param name="ParentNode"></param> private void EnumDirectories(TreeNode ParentNode) { treeView1.SelectedNode = ParentNode; string DirectoryPath = ParentNode.Tag.ToString( ); if(ParentNode.Nodes.Count == 0 ) { if(DirectoryPath.Substring(DirectoryPath.Length-1) != @"\") DirectoryPath += @"\"; try { foreach(string directory in Directory.GetDirectories(DirectoryPath)) { TreeNode TempNode = new TreeNode( ); TempNode.Text = directory.Substring(directory.LastIndexOf(@"\") + 1 ); TempNode.Tag = directory; TempNode.ImageIndex = 3; TempNode.SelectedImageIndex = 2; treeView1.SelectedNode.Nodes.Add(TempNode); treeView1.SelectedNode.Nodes[treeView1.SelectedNode.Nodes.Count-1].EnsureVisible( ); } } catch(Exception) { } } }