Using the VSPrinter Control > Using Unit-Aware Properties |
VSPrinter 8 allows you to specify virtually all measurements and positioning properties and parameters as a value followed by a unit (To allow this type of assignment, all unit-aware properties and method parameters are of type Variant.)
For example, the MarginLeft property may be assigned in several ways:
Example Title |
Copy Code
|
---|---|
vp.MarginLeft = 1440 ' no units, assume twips vp.MarginLeft = "1in" ' one inch vp.MarginLeft = "62pt" ' 62 points vp.MarginLeft = "2.3cm" ' 2.3 centimeters |
When the assignment is made, VSPrinterconverts the given measurement into the default units. This is done to allow the property to be used in mathematical expressions. For example:
Example Title |
Copy Code
|
---|---|
vp.MarginLeft = "1in" ' one inch vp.MarginLeft = 2 * vp.MarginLeft Debug.Print vp.MarginLeft " twips (default unit)" 2440 twips (default unit) |
The table below shows the units recognized by the VSPrinter control:
Symbol |
Unit |
---|---|
none |
Default unit (twips, except for the LineSpacing property). |
in, " |
Inches. |
twip |
Twips (one twip = 1/20th of a point). |
pt, point |
Points. |
cm |
Centimeters. |
mm |
Millimeters. |
pix |
Printer pixels. |
% |
Percentage. |
When you use percentage units, the meaning is context-dependent. For the LineSpacing property, 100% is single-space. For rendering pictures, 100% is actual size. For horizontal margins and table column widths, 100% is the page width.