如何直接跳过印刷的printDocument.print()对话框,并打印网页?对话框、跳过、直接、网页

由网友(孟婆持刀砍月老)分享简介:当我使用 MyPrintDocument.print()在用C#编写Windows应用程序,显示了一个取消按钮在Windows处理打印程序的对话框。我不想显示该对话框,这可能吗?When I use MyPrintDocument.print() in a Windows application written in...

当我使用 MyPrintDocument.print()在用C#编写Windows应用程序,显示了一个取消按钮在Windows处理打印程序的对话框。我不想显示该对话框,这可能吗?

When I use MyPrintDocument.print() in a Windows application written in C#, a dialog is shown for the Windows processing print routine with a cancel button. I don't want this dialog shown, is it possible?

如果不是,我应该用哪种方式?我的程序采用的是热敏打印机。

If not, which way should I use? My program uses a thermal printer.

推荐答案

其中PrintController您使用。

.NET框架包括从 PrintController 派生的三个打印控制器,可帮助完成常见任务。该 StandardPrintController 将文档打印到打印机。该 previewPrintController 生成的文件将是什么样子preVIEW打印,并使用由打印previewControl 和打印previewDialog 类。该 PrintControllerWithStatusDialog 在打印过程中提供了打印状态对话框。

The .NET Framework includes three print controllers that are derived from PrintController that help accomplish common tasks. The StandardPrintController prints a document to a printer. The PreviewPrintController generates a preview of what the document will look like when printed and is used by the PrintPreviewControl and PrintPreviewDialog classes. The PrintControllerWithStatusDialog provides a printing status dialog during the printing process.

这听起来像你正在使用的PrintControllerWithStatusDialog PrintController

It sounds like you are using the PrintControllerWithStatusDialog PrintController.

警告:的我不是在一个位置,以验证基本的 PrintController 不采取行动以同样的方式

Caveat: I am not in a position to verify that the basic PrintController doesn't act the same way.

根据该MSDN论坛发帖中的 PrintControllerWithStatusDialog 是默认的:

他建议是这样的:

MyPrintDocument.PrintController = new System.Drawing.Printing.StandardPrintController();