【发布时间】:2014-04-04 03:16:02
【问题描述】:
我有一个 WPF 应用程序,该应用程序中的一项任务是打印一份 Telerik 报告,这需要一些时间。
我已经通过使用 BackgroundWorker 解决了屏幕冻结问题,但我想在 ProgressBar 中显示打印过程,我已经阅读了一些示例,但所有示例都在谈论 FOR 循环并将整数传递给 ProgressBar,但不能使用我的情况。
如果可能,我该怎么做?
这是我的 BackgroundWorker DoWork:
void _printWorker_DoWork(object sender, DoWorkEventArgs e)
{
_receiptReport = new Receipt(_invoice.InvoiceID, _invoice.ItemsinInvoice.Count);
printerSettings = new System.Drawing.Printing.PrinterSettings();
standardPrintController = new System.Drawing.Printing.StandardPrintController();
reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
reportProcessor.PrintController = standardPrintController;
instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = _receiptReport;
reportProcessor.PrintReport(instanceReportSource, printerSettings);
}
提前致谢
【问题讨论】:
-
如果你不传递一个设置进度百分比的 int,ProgressBar 将如何显示进度?
-
我的问题是如何在我的情况下传递 int ??
标签: c# wpf backgroundworker