2

レポートがあり、それを印刷したいと考えています。現時点で私は使用しています:

myreport.PrintDialog()

Windows で [中止] をクリックするとPrintDialog、レポートは標準のプリンターで印刷されます。このアボートをどのように処理できますか? OK に印刷したいだけですが、処理できませんDialogResult

4

2 に答える 2

1

こんな仕事してんの?

PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
    // do your printing process here
}
于 2012-12-19T12:56:50.327 に答える
0

PrintTool.PrintDialog()メソッドから;

プリンターの選択、いくつかの印刷オプションの設定、およびドキュメントの印刷に使用する印刷ダイアログ ボックスを実行します。

Return value
Type: Nullable<Boolean> 
true if the user clicks OK in the dialog box; false if the user clicks Cancel;

How to: Print a Report

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");
}
于 2012-12-19T13:03:08.677 に答える