FolderBrowserDialog 不显示选择目录树
protectedvoidButton1_Click(objectsender,EventArgse){FolderBrowserDialogfolderBrowserD...
protected void Button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
// 设置根在桌面
folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.Desktop;
// 设置当前选择的路径
folderBrowserDialog1.SelectedPath = "C:";
// 允许在对话框中包括一个新建目录的按钮
folderBrowserDialog1.ShowNewFolderButton = true;
// 设置对话框的说明信息
folderBrowserDialog1.Description = "请选择输出目录";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
// 在此添加代码,选择的路径为 folderBrowserDialog1.SelectedPath
Label1.Text = folderBrowserDialog1.SelectedPath;
}
} 展开
{
FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
// 设置根在桌面
folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.Desktop;
// 设置当前选择的路径
folderBrowserDialog1.SelectedPath = "C:";
// 允许在对话框中包括一个新建目录的按钮
folderBrowserDialog1.ShowNewFolderButton = true;
// 设置对话框的说明信息
folderBrowserDialog1.Description = "请选择输出目录";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
// 在此添加代码,选择的路径为 folderBrowserDialog1.SelectedPath
Label1.Text = folderBrowserDialog1.SelectedPath;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询