C# Can';“打印时中止”对话框时不响应
我有一份报告,想打印出来。目前我正在使用:C# Can';“打印时中止”对话框时不响应,c#,devexpress,report,C#,Devexpress,Report,我有一份报告,想打印出来。目前我正在使用: myreport.PrintDialog() 如果我在WindowsPrintDialog上单击“中止”,报告将在标准打印机上打印。 我如何处理这个中止? 我只想在OK上打印,但我无法处理对话框result您是这样工作的吗 PrintDialog dialog = new PrintDialog(); if (dialog.ShowDialog() == DialogResult.OK) { // do your printing proce
myreport.PrintDialog()
如果我在WindowsPrintDialog
上单击“中止”,报告将在标准打印机上打印。
我如何处理这个中止?
我只想在OK上打印,但我无法处理
对话框result
您是这样工作的吗
PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
// do your printing process here
}
从方法上
运行用于选择打印机的打印对话框,设置一些
打印选项和打印文档
这段代码恰好重新创建了OP的问题。它将忽略PrintDialog()的返回值。
Return value
Type: Nullable<Boolean>
true if the user clicks OK in the dialog box; false if the user clicks Cancel;
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...
private void button1_Click(object sender, EventArgs e) {
// Create a report instance, assigned to a Print Tool.
ReportPrintTool pt = new ReportPrintTool(new XtraReport1());
// Invoke the Print dialog.
pt.PrintDialog();
// Send the report to the default printer.
pt.Print();
// Send the report to the specified printer.
pt.Print("myPrinter");
}