哪里有树行视图和列表视图的资料?
帮忙说一下,谢谢!
就是Treeview和Listview的使用拉
帮帮我!
private void EnumDrives(TreeNode ParentNode)
{
if(ParentNode.Nodes.Count==0)
{
foreach(string drive in Directory.GetLogicalDrives())
{
FolderTree.SelectedNode=ParentNode;
TreeNode TempNode=new TreeNode();
TempNode.Text=drive.Substring(0,drive.Length-1);
TempNode.Tag=drive;
TempNode.ImageIndex=1;
TempNode.SelectedImageIndex=1;
FolderTree.SelectedNode.Nodes.Add(TempNode);
FolderTree.SelectedNode.Nodes[FolderTree.SelectedNode.Nodes.Count-1].EnsureVisible();
}
}
}
private void EnumDirectories(TreeNode ParentNode)
{
FolderTree.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;
FolderTree.SelectedNode.Nodes.Add(TempNode);
FolderTree.SelectedNode.Nodes[FolderTree.SelectedNode.Nodes.Count-1].EnsureVisible();
}
}
catch(Exception)
{
}
}
}
}
}