2010-06-08 37 views

Trả lời

13

Bạn có thể sử dụng lớp PrintDialog mà không hiển thị hộp thoại (mà không gọi ShowModal)

2

Hãy thử

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

Đây là một trong những cách bạn có thể thay đổi máy in mặc định hoặc thay đổi các cài đặt khác:

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

Thật không may nếu bạn cố gắng in tệp có dấu đăng nhập, bất cứ ai biết các giải pháp cho in để tập tin? – Beno

Các vấn đề liên quan