Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Images and Picture Boxes

Status
Not open for further replies.

0mega

Programmer
May 3, 2001
3
US
What is needed to make a form print an image or picturebox ALONE without using PrintForm?
 
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


Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top