SaveFileDialog dialog = new SaveFileDialog(); dialog.InitialDirectory = "SomePath"//this is the path that I want to be root folder
您不能直接将其设置为SaveFileDialog上的属性.但是您可以尝试使用FileOk事件来验证文件是否在该目录中,否则取消事件!
dialog.FileOk += delegate (object sender,CancelEventArgs e) { if (dialog.FileName is in wrong directory) { e.Cancel = true; } };
如前所述,下一个最佳选择是建立自己的对话框!