首页 > 其他 > 详细

Customising the browse for folder dialog to show the path

时间:2021-04-26 15:30:14      阅读:14      评论:0      收藏:0      [点我收藏+]

Customising the browse for folder dialog to show the path

Does anyone know what is the simplest way to customise the System.Windows.Forms.FolderBrowserDialog so a path can be entered using text in a textbox below the tree.

I want this so it‘s easy to select unmapped UNC paths.

Looks like this this KB has some supporting information.

 

回答

Just this weekend I needed this.

I looked and looked but could not find it.

Resorted to writing it myself, based on that KB article, and some other things.

Here ya go. FolderBrowserDialogEx

Full Source code. Free. MS-Public license.

技术分享图片

 

 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;
     }

Capabilities: shows editbox, shows full path in edit box. Can be used to browse printers or computers, as well as files+folders, or just folders.

Edit, 2018-05-31: If the Codeplex link above does not work for you, this Git resource also exists. 

 

https://www.nuget.org/packages/FolderBrowserDialogEx

 

 

 

 

 

 

 

 

Customising the browse for folder dialog to show the path

原文:https://www.cnblogs.com/chucklu/p/14703997.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!