我正在开发一个使用快速报告的应用程序。 如果我修改了报告并关闭了设计器窗口,我会被问到是否要保存“Untitled.frx”。如何防止出现此对话框?
提前致谢
答案 0 :(得分:1)
有AskSave
属性:
var report = new Report();
Config.DesignerSettings.DesignerLoaded += (object sender, EventArgs e) =>
{
report.Designer.AskSave = false;
};
report.Design();
答案 1 :(得分:0)
这就是我解决问题的方法。 DesignerSettings_DesignerClosed方法是为了防止以后重新打开Designer时出现问题。 感谢@Grzegorz Brzęczyszczykiewicz提示AskSave()。
...
{
Config.DesignerSettings.DesignerLoaded += DesignerSettings_DesignerLoaded;
Config.DesignerSettings.DesignerClosed += DesignerSettings_DesignerClosed;
Report.ReportData.Design(false);
}
private void DesignerSettings_DesignerClosed(object sender, EventArgs e) {
Config.DesignerSettings.DesignerLoaded -= DesignerSettings_DesignerLoaded;
Config.DesignerSettings.DesignerClosed -= DesignerSettings_DesignerClosed;
}
private void DesignerSettings_DesignerLoaded(object sender, EventArgs e) {
Report.ReportData.Designer.AskSave = false;
}