ComponentOne VSView 8.0
DrawPicture Method (VSPrinter)

Draws a picture.

Syntax

[form!]VSPrinter.DrawPicture Picture As Picture, Left As Variant, Top As Variant, [ Width As Variant ], [ Height As Variant ], [ Align As Variant ], [ Shade As Variant ]

Remarks

The parameters for the DrawPicture method are described below:

 

Parameter

Description

Picture

Picture to draw. May be a reference to a bitmap, icon, or metafile.

LeftTop

Position of the top left corner of the picture on the page.

WidthHeight

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.

 

All measurement parameters may be specified with units (inches, points, twips, cm, mm, or pixels). The default unit is twips. For details on using unit-aware measurements, see the Using Unit-Aware Properties topic.

The Width and Height parameters may also be specified as percentages of the picture's natural size.

For example:

' draw a picture, scale to half the natural size

vp.DrawPicture Picture1, "2in", "2in", "50%", "50%"

 

' draw a picture, natural size

vp.DrawPicture Picture1, "2in", "2in", "100%", "100%"

 

' draw a picture, scale to twice the natural size

vp.DrawPicture Picture1, "2in", "2in", "200%", "200%"

The Align parameter allows you to determine how the picture will be scaled and aligned within the given rectangle. Valid settings are:

 

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).

 

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.

The picture below shows the effect of each setting:

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback