Printer Object
 
Syntax
 
Printer.DrawPicture BmpFile, Left, Top[, Width][, Height][,Align][,Shade]
 
Description
Draws a picture.
 
All measurement parameters may be specified with units (inches, points, twips, cm, mm, or pixels). The default unit is twips.
 
The Width and Height parameters may also be specified as percentages of the picture’s natural size.
 
The Align parameter allows you to determine how the picture will be scaled and aligned within the given rectangle. Valid settings are listed in the table below.
 
None of the settings allow the picture to overflow the rendering rectangle. The first ten settings (vppaLeftTop through vppaClip) will clip the picture if it is too large to fit the rectangle, and will leave parts of the rectangle empty if the picture is too small.
 
The vppaZoom setting will stretch (or shrink) the picture so that one of its dimensions matches the rendering rectangle, and the other dimension will be calculated so as to preserve the picture’s aspect ratio. This setting is useful when rendering pictures that should not be distorted in a rectangle of fixed size.
 
Parameter
Description
BmpFile
Picture to draw. May be a reference to a bitmap, icon, or metafile.
Left, Top
Position of the top left corner of the picture on the page.
Width, Height
Optional parameters that determine the size of the picture on the page. If omitted, the natural size is used.
Align
How to scale and align the picture within the given rectangle. If provided, must be a value from the PictureAlignSettings enumeration. The default value is vppaStretch, which stretches the picture to fill the rectangle. For details, see the example below.
Shade
Specifies whether the box will be outlined with the current pen and shaded with the current brush. Optional, defaults to False.
vsPictureAlignSettings
 
This parameter contains the following pre-defined constants and values:
 
Constant
Value
Description
vppaLeftTop
0
Align to the left top corner of the rectangle.
vppaCenterTop
1
Align to the center and to the top of the rectangle.
vppaRightTop
2
Align the right top corner of the rectangle.
vppaLeftBottom
3
Align to the left bottom corner of the rectangle.
vppaCenterBottom
4
Align to the center and to the bottom of the rectangle.
vppaRightBottom
5
Align to the right bottom corner of the rectangle.
vppaLeftMiddle
6
Align to the left and to the middle of the rectangle.
vppaCenterMiddle
7
Align to the center and to the middle of the rectangle.
vppaRightMiddle
8
Align to the right and to the middle of the rectangle.
vppaClip
9
Align to the center and to the middle of the rectangle (same as vppaCenterMiddle)
vppaZoom
10
Fit rectangle while preserving aspect ratio.
vppaStretch
11
Fill rectangle, stretching the picture as needed.
vppaTile
12
Fill rectangle by tiling copies of the picture (useful for rendering backgrounds).
 
See Also
Example