0

我有一个打印按钮,可以将我的 Crystal 报表直接打印到打印机上。我的代码如下:

CrystalDecisions.CrystalReports.Engine.ReportClass clsReport = new CrystalDecisions.CrystalReports.Engine.ReportClass();

protected void Button3_Click(object sender, EventArgs e)
{
    System.Windows.Forms.PrintDialog dialog1 = new System.Windows.Forms.PrintDialog();



    dialog1.AllowSomePages = true;
    dialog1.AllowPrintToFile = false;


    if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        int copies = dialog1.PrinterSettings.Copies;
        int fromPage = dialog1.PrinterSettings.FromPage;
        int toPage = dialog1.PrinterSettings.ToPage;
        bool collate = dialog1.PrinterSettings.Collate;

        clsReport.PrintOptions.PrinterName = dialog1.PrinterSettings.PrinterName;
        clsReport.PrintToPrinter(copies, collate, fromPage, toPage);



    }

}

这工作正常,但我的问题是,每当我点击打印按钮时,打印对话框出现在所有页面的后面,所以有时我什至看不到它是否出现。所以,我想把打印对话框放在所有窗口的前面。

谢谢你。

4

0 回答 0