问题描述
大家好,
有没有可以在c#中选择文件和目录的Dialog浏览器?
我在WPF应用程序中需要它,一个对话框浏览器可以选择文件和目录.
如果没有这样的课程,请给我建议一个简单的方法.
谢谢.
Hello all,
Is there any Dialog browser that can select both files and directories in c#?
I need it in my WPF App that, a dialog browser can select both files and directories.
And if there is no such class, please suggest me an easy way to do that.
Thanks.
推荐答案
var dlg1 = new Ionic.Utils.FolderBrowserDialogEx();
dlg1.Description = "Select a folder to extract to:";
dlg1.ShowNewFolderButton = true;
dlg1.ShowEditBox = true;
//dlg1.NewStyle = false;
dlg1.SelectedPath = txtExtractDirectory.Text;
dlg1.ShowFullPathInEditBox = true;
dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer;
// Show the FolderBrowserDialog.
DialogResult result = dlg1.ShowDialog();
if (result == DialogResult.OK)
{
txtExtractDirectory.Text = dlg1.SelectedPath;
}
此功能允许您键入一个路径,甚至可以输入UNC路径.您可以浏览文件夹或文件+文件夹.可以使用它浏览计算机或打印机.更灵活.如果在GUI中单击文件夹,则路径出现在文本框中.如果键入路径,则该文件夹将被激活.内置对话框有很多选项."-Cheeso说,这是创建该对话框的人.
"This one allows you to type in a path, even a UNC path. You can browse for folders, or files+folders. You can browse for computers or printers with it. More flexible. If you click a folder in the GUI, the path appears in the textbox. If you key in a path, the folder gets activatied. Lots of options the built-in dialog"- Cheeso says, the one who created this.
这篇关于文件和目录对话框浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!