C# WinForm 选择目录路径和文件路径
private string SelectPath() //弹出一个选择目录的对话框 { FolderBrowserDialog path = new FolderBrowserDialog(); path.ShowDialog(); return path.SelectedPath; } private string SelectFile() //弹出一个选择文件的对话框 { OpenFileDialog file = new OpenFileDialog(); file.ShowDialog(); return file.SafeFileName; }