ZombieCoder8
ZombieCoder8

Reputation: 35

how to hide printing popup in c#?

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

Answers (1)

Bibin
Bibin

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

Related Questions