如何防止 SaveFileDialog 提示两次 replace/overwrite 一个文件?
How do I prevent a SaveFileDialog from prompting twice to replace/overwrite a file?
如何阻止 System.Windows.Forms.SaveFileDialog
提示两次来替换所选文件,而只提示一次?
要么是我遗漏了什么,要么是我的安装有问题,要么是默认行为很愚蠢。
var saveFileDialog = new SaveFileDialog();
saveFileDialog.ShowDialog();
// User selects file and clicks "Save" within the dialog
我没有做任何特别的事情,这是一个空的 Windows Forms 项目,目标是 .NET Framework 4.7.2。
编辑:添加完整 Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var saveFileDialog = new SaveFileDialog();
saveFileDialog.ShowDialog();
}
}
}
这似乎是最新 .Net 版本中的错误。
它不会发生在 10.0.17763
之前的 Windows 版本中
如何阻止 System.Windows.Forms.SaveFileDialog
提示两次来替换所选文件,而只提示一次?
要么是我遗漏了什么,要么是我的安装有问题,要么是默认行为很愚蠢。
var saveFileDialog = new SaveFileDialog();
saveFileDialog.ShowDialog();
// User selects file and clicks "Save" within the dialog
我没有做任何特别的事情,这是一个空的 Windows Forms 项目,目标是 .NET Framework 4.7.2。
编辑:添加完整 Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var saveFileDialog = new SaveFileDialog();
saveFileDialog.ShowDialog();
}
}
}
这似乎是最新 .Net 版本中的错误。 它不会发生在 10.0.17763
之前的 Windows 版本中