Make your own free website on Tripod.com
Print Picture

The following code will show you how to print picture from Picture Box,
Image control, form, or any other control.

You can determine the picture placement on the paper, and
also determine the picture size.

Preparations

Add 1 Picture Box and 1 Command Button to your form.
Place picture in the Picture Box's Picture Property.

Form Code

Private Sub Command1_Click()
' replace all "Picture1" below with name of the Picture Box or
' other control that you want to print its picture.
' replace the "0, 0" below with the coordinates of the picture
' on the printed paper. "0, 0" will print the picture in the
' upper left corner. If you want to print the picture where
' the printer's head is currently found, instead of "0, 0"
' use "Printer.CurrentX, Printer.CurrentY" (if you printed text
' and then you'll print the picture with the
' "Printer.CurrentX, Printer.CurrentY" coordinates, the picture
' will be printed immediately after the text).
' If you want to enlarge or to reduce the size of the picture,
' replace the "Picture1.Width, Picture1.Height" with your
' desirable picture width and height.
' for example: "Picture1.Width * 2, Picture1.Height * 2"
' will print the picture in double size, and:
' "Picture1.Width * 0.5, Picture1.Height * 0.5"
' will print the picture in half size.

     Printer.PaintPicture Picture1.Picture, 0, 0, _
       Picture1.Width, Picture1.Height
' use the EndDoc command if the picture is the last item you want
' to print on the paper

     Printer.EndDoc
End Sub

Go Back