【发布时间】:2015-03-16 10:35:36
【问题描述】:
在我的打印窗口中,我编写了以下代码:
public void ShowReport(ReportDocument rp)
{
MyCrystalReportsViewer.ViewerCore.ReportSource = rp;
this.WindowState = WindowState.Maximized;
MyCrystalReportsViewer.ViewerCore.PrintReport();
}
我从另一个类调用这个方法,但是当我显示打印窗口时,默认情况下没有出现打印对话框。
谁能解决我在调用打印窗口时显示打印对话框的问题。
提前致谢
【问题讨论】:
-
为什么不加载报告(ReportDoucment report= new ReportDocument(); report.Load())然后它有一个打印按钮,会显示打印对话框?
-
我已经在其他类中加载了报告,然后导航到上述方法。
-
只有当我像 PrintDialog printDialog = new PrintDialog(); 这样写时,上述语句才有效printDialog.ShowDialog(); MyCrystalReportsViewer.ViewerCore.PrintReport();这里的问题是只有在执行第二条语句时才执行第三条语句。主要问题是出现了两个打印对话框。如果我使用第二条语句,它不会打印当前的 ReportDocument。请任何人帮助我。
标签: c# wpf printing visual-studio-2013 crystal-reports