选定文件夹 string foldPath = ""; FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.Description = "请选择文件路径"; dialog.SelectedPath = ""; //dialog.RootFolder = Environment.SpecialFolder.Programs; if (dialog.ShowDialog() == DialogResult.OK) { foldPath = dialog.SelectedPath; } else { return; }
打开文件
OpenFileDialog openFileDialog1 = new OpenFileDialog();
string File_Name = "";
openFileDialog1.Filter = "所有文件(*.*)|*.*";
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
File_Name = openFileDialog1.FileName;
}
else
{
return;
}
`