2010-06-08 7 views

Répondre

13

Vous pouvez utiliser la classe PrintDialog sans montrer la boîte de dialogue (sans appeler ShowModal)

2

Essayez

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

Ceci est l'une des façons dont vous pouvez changer imprimante par défaut ou modifier d'autres paramètres:

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

Malheureusement, si vous essayez d'imprimer dans le fichier, il y a un dia journal, quelqu'un connaît la solution pour imprimer au fichier? – Beno

Questions connexes