C# 选择文件夹 选择文件
作者:互联网
https://www.cnblogs.com/qc-id-01/p/7489021.html
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
//dialog.RootFolder = Environment.SpecialFolder.Programs;
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
}
//选择文件
OpenFileDialog dialog = new OpenFileDialog();
dialog.Multiselect = true;//该值确定是否可以选择多个文件
dialog.Title = "请选择文件夹";
dialog.Filter = "所有文件(*.*)|*.*";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string file = dialog.FileName;
}
标签:文件,string,C#,DialogResult,选择,文件夹,dialog,new 来源: https://www.cnblogs.com/LuoCore/p/15353080.html