当我在用 C# 编写的 Windows 应用程序中使用 MyPrintDocument.print()
时,会显示一个带有取消按钮的 Windows 处理打印例程的对话框。我不想显示此对话框,这可能吗?
如果不是,我应该使用哪种方式?我的程序使用热敏打印机。
最佳答案
哪个PrintController你在用吗?
The .NET Framework includes three print controllers that are derived from
PrintController
that help accomplish common tasks. TheStandardPrintController
prints a document to a printer. ThePreviewPrintController
generates a preview of what the document will look like when printed and is used by thePrintPreviewControl
andPrintPreviewDialog
classes. ThePrintControllerWithStatusDialog
provides a printing status dialog during the printing process.
听起来您正在使用 PrintControllerWithStatusDialog
打印 Controller
。
警告:我无法验证基本的 PrintController
是否以相同的方式运行。
根据这个MSDN Forum Posting PrintControllerWithStatusDialog
是默认值:
他建议是这样的:
MyPrintDocument.PrintController = new System.Drawing.Printing.StandardPrintController();
关于c# - 如何跳过printDocument.print()中的打印对话框,直接打印页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10572420/