Printer.PaintPicture pic.Picture, 0, 0, pic.Width, pic.Height - TechRepublic
Question
November 10, 2021 at 07:23 PM
bkandler

Printer.PaintPicture pic.Picture, 0, 0, pic.Width, pic.Height

by bkandler . Updated 4 years, 5 months ago

This ought to be trivial. I have a large picturebox filled with lines and fills in twips and I need to break it into page size pieces. There are many samples that are based on the above statement. But I get “invalid picture”. Trying variations the only one that doesn’t error is

Printer.PaintPicture pic.Image, 0, 0, pic.Width, pic.Height
But it produces nothing!

Else where in my code, I have

If SetupPrinter(Me) Then
pic.Picture = pic.Image
Printer.PaintPicture pic.Picture, Printer.CurrentX, Printer.CurrentY
Printer.EndDoc
End If

that works grand. But in this case:

pic.Picture = pic.Image

Erases the picturebox.

All Comments