You also can use Page Setup dialogs to specify page details for printing. You can let users set border and margin adjustments, headers and footers, and portrait or landscape orientation, and so on. You can see a Page Setup dialog in Figure 9.10 from the Printing example on the CD-ROM.
You can use the PrinterSettings property of this dialog box to get a Printer Settings object that holds the settings that the user specified, and assign that object to a PrintDocument object's PrinterSettings property to make sure the settings the user wants are assigned to the document itself. Here's how that might look in code:
Private Sub MenuItem2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MenuItem2.Click PageSetupDialog1.Document = PrintDocument1 PageSetupDialog1.PrinterSettings = PrintDocument1.PrinterSettings If PageSetupDialog1.ShowDialog = DialogResult.OK Then PrintDocument1.PrinterSettings = PageSetupDialog1.PrinterSettings End If End Sub
That gives us a look at what we'll be covering in this chapter. Now it's time to start looking at individual points in the Immediate Solutions section.