2010-06-08 108 views

回答

13

您可以使用PrintDialog类类,而不显示对话框(不调用的ShowModal)

2

尝试

PrintDialog dialog = new PrintDialog(); 
dialog.PrintVisual(_PrintCanvas, "My Canvas"); 
13

这是可以改变的途径之一默认打印机或更改其他设置:

using System.Printing; //add reference to System.Printing Assembly 
         //if you want to modify PrintTicket, also add 
         //reference to ReachFramework.dll (part of .net install) 
... 

var dlg = new PrintDialog(); 

dlg.PrintQueue = printer; // this will be your printer. any of these: new PrintServer().GetPrintQueues() 
dlg.PrintTicket.CopyCount = 3; // number of copies 
dlg.PrintTicket.PageOrientation = PageOrientation.Landscape; 

dlg.PrintVisual(canvas); 
+2

不幸的是,如果您尝试打印文件有一个dia日志,任何人都知道打印文件的解决方案? – Beno 2012-08-28 04:12:47

相关问题