protected void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { PrintMessage message = new PrintMessage(e); // The message must be executed synchronously. That's because the printing code will // need to access the graphic context contained in e, but if we were to return // immediately this graphic context would be discarded. The execution thread would // then try to access random memory, and plague and pestilence would ensue. message.Synchronous = true; executionThread.Enqueue(message); }
private void ExecutionProcessPrintMessage(PrintMessage print, Program program) { program.PrintOnePage(print.Arguments, new Font("Arial Unicode MS", 10)); }