Game Development Reference
SimplePrintDocument printDocument = new SimplePrintDocument(inputText,
if (cachedSettings != null)
printDocument.DefaultPageSettings = cachedSettings;
PrintDialog printDialog = new PrintDialog();
printDialog.Document = printDocument;
if (printDialog.ShowDialog() == DialogResult.OK)
Figure 21.2 shows the Page Setup dialog in action.
Figure 21.2 Page Setup dialog in action.
Supporting Print Preview
The last common print feature is the ability to preview a document before actually
printing it. This is done with the PrintPreviewDialog class. Simply attach your print
document to the Document property of the dialog and show the dialog as usual. The
following code shows how to do this.