Printing shortcut in .NET v2.0 (windows apps)
.NET v1.1 was not very developer friendly when it came to printing data from a Windows application. I'd like to think this has improved a bit with .NET v2.0 and recently I almost had an oppertunity to delve in and see for myself if anything had improved, however some annoying thing called a deadline reared it's ugly head and coupled with it's pain in the *** friend 'the budget' I couldn't dwell in the MSDN.
I needed a solution fast and the answer came in the WebControl. It was simple take the data, wrap it in some html, a table here, an image there and post it to the WebControl's Document property as a web page. What made this work is you can invoke the WebControls Print() method, which sends the displayed web page to the default printer (not idea), or you can invoke the WebControls ShowPrintDialog() method which displays the print dialog and then automatically prints the page if ok'd.
So a 10 minute job to get the report feature working gave me plenty of time to go and talk to the sexy chick that sits downstairs. The deadline was met, the budget was happy, and a wee gold star for me.