本文共 516 字,大约阅读时间需要 1 分钟。
WPF 获得文件夹路径可用FolderBrowserDialog类,
添加System.Windows.Forms引用,
并引用命名空间using System.Windows.Forms;
1 private void button1_Click(object sender, RoutedEventArgs e) 2 { 3 FolderBrowserDialog fbd = new FolderBrowserDialog(); 4 fbd.Description = "pls select a folder"; 5 if(fbd.ShowDialog() == DialogResult.OK) 6 { 7 textBox1.Text = fbd.SelectedPath; 8 } 9 }
本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/archive/2011/07/26/2117698.html,如需转载请自行联系原作者