System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
dialog.Description = "请选择文件夹";
dialog.ShowNewFolderButton = true; // 显示 新建文件夹 按钮
dialog.SelectedPath = Environment.CurrentDirectory; // 设置 选择的路径 为 当前项目路径
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// 判空
if (string.IsNullOrEmpty(dialog.SelectedPath)) { MessageBox.Show(this, "文件夹路径不能为空", "温馨提示"); return; }
textBox7.Text = dialog.SelectedPath; // 获取 选择的 文件夹 路径
}