Reputation: 35
I have a print function which prints received messages in my application this application is a background process, but as soon as I get a new message, it displays "printing box" for a brief moment, how can I hide this.
PrintDocument DocumentPrint = new PrintDocument();
DocumentPrint.PrintPage += new PrintPageEventHandler(page_print);
DocumentPrint.Print();
private void page_print(object sender, PrintPageEventArgs ev)
{
ev.Graphics.DrawString(strMessagePrint,
clsGlobals.DEFAULT_PRINTER_FONT,
Brushes.Black,
new Point(clsGlobals.DEFAULT_LEFT_MARGIN, clsGlobals.DEFAULT_TOP_MARGIN));
}
Upvotes: 2
Views: 491
Reputation: 542
Solve the problem to use PrintDocument's PrintController
to StandardPrintController
should solve this.
PrintDocument printDocument = new PrintDocument();
PrintController printdisable = new StandardPrintController();
printDocument.PrintController = printdisable ;
Upvotes: 2