CodeItBetter Programming Another VB Programming Blog

How to Print the Picture to Printer

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'Miscellaneous - How to Print the Picture to Printer

'Add a Picture Box and a Command Button to your form and add picture to Picture1

Private Sub Command1_Click()
    '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
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.