c#窗体设计之树形文件结构
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
{
}
private void button1_Click(object sender, EventArgs e)
{
folderBrowserDialog1.RootFolder= Environment.SpecialFolder.MyComputer;
folderBrowserDialog1.ShowNewFolderButton = false;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;Baidu Nhomakorabea
using System.Text;
using System.Windows.Forms;
{child=fu.Nodes.Add(s);
createchildNode(child);
}
}
}
}
if(folderBrowserDialog1.ShowDialog()!=DialogResult.OK)
return;
TreeNode Node ;
treeView1.Nodes.Clear();
Node = treeView1.Nodes.Add(folderBrowserDialog1.SelectedPath);
createchildNode(Node);
Node.Expand();
}
private void createchildNode(TreeNode fu)
{
TreeNode child;
string path=fu.Text;
foreach(String s in Directory.GetDirectories(path))
using System.IO;
namespace树形窗体
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
}
private void button1_Click(object sender, EventArgs e)
{
folderBrowserDialog1.RootFolder= Environment.SpecialFolder.MyComputer;
folderBrowserDialog1.ShowNewFolderButton = false;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;Baidu Nhomakorabea
using System.Text;
using System.Windows.Forms;
{child=fu.Nodes.Add(s);
createchildNode(child);
}
}
}
}
if(folderBrowserDialog1.ShowDialog()!=DialogResult.OK)
return;
TreeNode Node ;
treeView1.Nodes.Clear();
Node = treeView1.Nodes.Add(folderBrowserDialog1.SelectedPath);
createchildNode(Node);
Node.Expand();
}
private void createchildNode(TreeNode fu)
{
TreeNode child;
string path=fu.Text;
foreach(String s in Directory.GetDirectories(path))
using System.IO;
namespace树形窗体
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)