-----------------------------
.NetCF: C#-VB.Net
Documentation eVC
(C/C++/MFC), eVB: ----------------------------- Software Developers Special Topics
Printing Utilities |
// Print the contents of text onto page // Note: for simplicity of this code, we assume "text" string to contain all text to be printed. // PrinterCE prce = null; try { prce = new PrinterCE(); //Create instance of PrinterCE class prce.SelectPrinter(true); prce.PrOrientation = PrinterCE.ORIENTATION.PORTRAIT; //Force to portrait mode prce.ScaleMode = PrinterCE.MEASUREMENT_UNITS.INCHES; //Everything in inches //The following call automatically prints the entire contents of "text" //on full page using as many pages as necessary. int rlen=prce.DrawTextFlow(text); prce.EndDoc(); //Done with this page - print it } catch (PrinterCEException exc) { if (prce!=null) { prce.ShutDown(); //Done - free PrinterCE resources // NOTE: Only call ShutDown if PrinterCE instance is about to be destroyed. } prce=null; MessageBox.Show("PrinterCE Exception","Exception"); } finally { if (prce!=null) { prce.ShutDown(); //Done - free PrinterCE resources // NOTE: Only call ShutDown if PrinterCE instance is about to be destroyed. } prce=null; } |