2010-06-08 190 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

相關問題