Windows Control:
The Page Setup Dialog Box



As opposed to directly printing a file, a user may want to perform some preliminary preparation on the document or the printer. Microsoft Windows provides another dialog box used to control printing. It is called Page Setup:

Page Setup

To provide a Page Setup to your application, you can use the PageSetupDialog button Page Setup from the Toolbox. The PageSetupDialog control is based on the PageSetupDialog class which derives from the CommonDialog class.

Characteristics of the Page Setup Dialog Box

When using the Page Setup dialog box, the user must first select a printer. This is usually done already by the operating system that selects the default printer of the computer that called this dialog box. Otherwise, to select a printer or to change the printer, the user can click the Printer button and select or change it using the Name combo box:

Page Setup

Displaying the Page Setup Printer dialog box also allows you and/or the user to customize the printing process if necessary. If you want to do this, you can use the PageSetupDialog.PrinterSettings property which is a value of the PrinterSettings class reviewed earlier.

After selecting the printer, the user can click OK. The options of the Page Setup dialog box depend on the driver of the printer selected in the Name combo box. The Page Setup dialog box allows the user to customize the appearance of the paper on which the document would be printed.

On the Page Setup, the user can click the arrow of the Size combo box and select one of the configured sizes of paper. The characteristics of the paper are controlled by the PageSettings class that we mentioned earlier. For example, if the printer has many trays, as indicated by the driver of the selected printer, the user can select which tray would be used when printing. As it happens, one printer can have only one tray while another printer can have 3, 5, or more trays.

If the desired printer is on a network, the user can click the Network button to locate it. To programmatically show or hide the Network button, specify a false or true result to the PageSetupDialog.ShowNetwork Boolean property.

The user also has the option to print the document in Portrait (vertical) or in Landscape (horizontal) position. The option to allow the user to select Portrait or Landscape is controlled by the AllowOrientation Boolean property.


Home Copyright © 2008-2016, FunctionX, Inc.