WPF中弹出文件夹浏览对话框
2016-09-05 17:13
99 查看
附一个共享目录正则表达式判断:
bool result= System.Text.RegularExpressions.Regex.IsMatch("\\pc-test\share", @"^\\\\[a-zA-Z0-9\.-]+(\\([^\\\?\/\*\|<>:" + "\"" + "])+){1,}$");
private void btnSelectNetShareDir_Click(object sender, RoutedEventArgs e) { txtNetUploadDir.Text = string.Empty; System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); System.Windows.Interop.HwndSource hwn = PresentationSource.FromVisual(this) as System.Windows.Interop.HwndSource; System.Windows.Forms.IWin32Window win = new WinFormWindow(hwn.Handle); fbd.ShowNewFolderButton = true; fbd.Description = "请选择共享目录..."; if (fbd.ShowDialog(win) == System.Windows.Forms.DialogResult.OK) { txtNetUploadDir.Text = fbd.SelectedPath; } } public class WinFormWindow : System.Windows.Forms.IWin32Window { IntPtr _handle; public WinFormWindow(IntPtr handle) { _handle = handle; } IntPtr System.Windows.Forms.IWin32Window.Handle { get { return _handle; } } }
相关文章推荐
- 【JAVA】StringTokenizer 迭代方式对字符串进行分割
- eclipse git 插件集成与本地使用
- ffmpeg源码分析--14.安装外部库x264
- Android开发——HandlerThread以及IntentService详解
- AngularJS的一种参数传递方法
- AngularJS的一种参数传递方法
- ffmpeg学习---7.音视频同步之视频同步音频
- SIT测试 和 UAT测试
- 2016 9月版本的linphone for android make 不能执行py,pl,sh等脚本问题
- 「PSR 规范」PSR-4 自动加载规范
- ffmpeg源码分析--13.av_find_best_stream
- Python 图像转字符图像 PIL模板库
- Android开发——HandlerThread以及IntentService详解
- cmd 登录oracle
- 执行Git命令时出现各种 SSL certificate problem 的解决办法
- Linux用户管理类命令
- 走过2015,2016我将继续前行
- 安卓智慧上海学习笔记系列——自定义圆环进度条
- c++中值传递,引用传递,指针传递的区别
- java____设计模式之动态代理模式