The TPageSetupDialog component (Dialogs category) is a nonvisual component that encapsulates the common Windows Page Setup dialog. This component is really useful because it shows the default printer settings in its properties. The TPageSetupDialog component and its published properties are displayed in the following figure.
As you can see in Figure 27-2, the TPageSetupDialog component very effectively answers the standard set of questions we need answered in order to start printing:
Figure 27-2: The TPageSetupDialog component at run time and its properties
What is the size of the paper?
What measurement units are used?
What are the margin dimensions?
The most important property by far is the Units property, which specifies the units used by the user. The Units property is a TPageMeasureUnits enumeration, which allows you to use one of the following three values:
pmDefault — The user must specify values in units defined by locale settings.
pmMillimeters — The user must specify values in millimeters.
pmInches — The user must specify values in inches.
The default value of the Units property is pmDefault. When the Units property is set to pmDefault, the TPageSetupDialog component uses locale settings to determine the paper and margin settings (the TPageSetupDialog component expresses these values in thousandths of an inch or thousandths of a centimeter).
Since my machine uses the metric system (see Figure 27-3), the TPageSetupDialog component sets all margins to 2500 (2.5 cm, roughly one inch). On a machine that uses the U.S. measurement system, the TPageSetupDialog component sets margins to 1000 (one inch).
Figure 27-3: Locale settings