【发布时间】:2008-12-05 00:36:14
【问题描述】:
我正在使用 .net 的 PrintPreviewDialog,每当它生成预览时,它都会在后台锁定我的 GUI,让它看起来像是崩溃了,直到预览完成。看到弹出的.net页面进度窗口不是对话框,可以选择背景,然后以半画、锁定的方式来到前面。当用户单击预览对话框上的实际“打印”按钮以及我刚刚运行 PrintDocument.Print() 时,也会发生这种情况。当用户等待 .net 绘制打印页面时,是否有一种简单的方法可以修改以下代码以阻止 GUI 挂起:
//just showing a preview, hangs up background GUI on generating the preview
// and when user prints straight from the preview
this.printPreviewDialog.ShowDialog(this);
//just trying to print a .net PrintDocument class, GUI hangs in background
// when .net is drawing the pages
this.printDocument.Print();
【问题讨论】:
-
您生成文档的代码中似乎存在性能问题。
标签: c# .net multithreading user-interface printing