Control Reference > VSPrinter Control > VSPrinter Properties > Picture Property (VSPrinter) |
Returns a picture of the current preview page or sets a picture to be displayed on the page.
[form!]VSPrinter.Picture[ = Picture ]
Getting the Picture property returns a picture of the current preview page. The picture returned is an enhanced metafile that can be assigned to another control, saved with the VB SavePicture method, or copied to the clipboard to be pasted into another application.
For example:
Clipboard.Clear
Clipboard.SetData vp.Picture
Setting the Picture property renders the picture on the current page. The position and size of the picture on the page are determined by the X1, Y1, X2, and Y2 properties. If the rectangle defined by these properties is invalid (X2 <= X1 or Y2 <= Y1), the picture is not rendered. It is measured instead, and the X2 and Y2 properties are adjusted to reflect the picture's natural size.
However, the DrawPicture method provides a better way to render pictures than using the Picture property. DrawPicture has flexible parameters that allow you to scale, align, and clip pictures.
Note that the picture returned by the Picture property is an enhanced metafile. If you want to get a regular metafile instead, use the following method:
' 1) copy the current page to the clipboard
vp.Action = paCopyPage
' 2) retrieve a regular metafile from the clipboard
metaPict.Picture = Clipboard.GetData(vbCFMetafile)
This method works because the paCopyPage action copies the current picture to the clipboard both as an enhanced and regular metafiles.
Picture