文件和目录对话框浏览器 [英] Both File and Directory Dialog Browser

查看:92
本文介绍了文件和目录对话框浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有没有可以在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.

推荐答案

FolderBrowserDialogEx 可能会帮助您.它带有cheeso创建的dotnetzip库.它也是一个免费软件.您只需将dotnetzip库中的Ionic.Utils dll添加到您的项目中,这就是使用它的代码.

FolderBrowserDialogEx might help you. This comes with dotnetzip library created by cheeso. Its a freeware too. You just have to add the Ionic.Utils dll from dotnetzip library to your project and this is the code to use it.

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.


这篇关于文件和目录对话框浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆