Capture print dialog's cancel in silverlight printing

爷,独闯天下 提交于 2020-01-03 10:44:54

问题


Does anyone know if you can find out if the print dialog's cancel was clicked?

I've seen post and doc that say "EndPrint – Event fired when the printing is either completed or canceled. "

But I don't think that is the print dialog's canceled... I think the is if the print job is canceled.

thanks


回答1:


Based on the documentation, I don't believe there's an easy way: http://msdn.microsoft.com/en-us/library/system.windows.printing.printdocument.endprint(v=VS.95).aspx

In particular:

The EndPrint event will not occur if the user cancels the print operation from the print dialog box. A BeginPrint event will always occur before an EndPrint event.

Apparently the EndPrint event is only to clean up in the case of the document actually printing, not in the case of canceling the print dialog.




回答2:


There is one way, if the 'PrintPage' event is not CALLED after you call 'printDocument.Print()' method that means 'Cancel' button was pressed by the user on print dialog.

hope it helps.



来源:https://stackoverflow.com/questions/3803967/capture-print-dialogs-cancel-in-silverlight-printing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!