<pro>
// 窗体加载时发生 private void Form1_Load(object sender, EventArgs e)
{
//定义父级节点 TreeNode parent = new TreeNode(“我的电脑”);
parent.Tag = “”;
//获取当前所有驱动器信息 string[] drives = Directory.GetLogicalDrives();
//将当前驱动器信息添加到树型列表中 foreach (string drive in drives)
{
TreeNode child = new TreeNode();
child.Text = drive.Substring(0, 1) + “盘”;
child.Tag = drive;
//为当前驱动器加载所有目录 //AddNodes(child); parent.Nodes.Add(child);
}
//添加父级节点到树型列表中 tvList.Nodes.Add(parent);
List(“”);
}
</pro>