Question Locked

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

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

6 replies

by birdmantd

What is the application/program used? I cannot guess what you are using or what the issue is.

by bkandler

it's a home grown vb6 app with over 5000 users.

in the same program this works:

cmdColor.picSide.Picture = cmdColor.picSide.Image
Printer.PaintPicture cmdColor.picSide.Picture, Printer.TextWidth(ini.LinePfx), Printer.CurrentY

but this does not

DisplayRingTop Me.pic, lyr, True
DrawCenterMarks Me.pic, ini.CenterJigPost / 2, 0
Me.pic.Picture = Me.pic.Image
Printer.PaintPicture Me.pic.Picture, 0, 0, pic.Width, pic.Height

The setup for both is the same unit (inches) and scalemode settings save sizes. DisplayRingTop actually used in both places. I can send pics and more code.

by bkandler

pared down to the minimum, this prints an empty page. GO shows up in pic:

pic.Print "GO"
Printer.PaintPicture Me.pic.Image, 0, 0, pic.Width, pic.Height
Printer.EndDoc

and this results in invalid picture

pic.Print "GO"
pic.Picture = pic.Image
Printer.PaintPicture Me.pic.Picture, 0, 0, pic.Width, pic.Height
Printer.EndDoc

In other places, this works:

cmdColor.picSide.Picture = cmdColor.picSide.Image 'capture image
Printer.PaintPicture cmdColor.picSide.Picture, Printer.TextWidth(ini.LinePfx), Printer.CurrentY 'print it

by rproffitt

Last year our office finally did the end of support for a few VB6 apps. It was time for a few reasons but mostly because the setup was getting harder and harder and the client didn't agree to pay for continued work or conversion to something more current.

So my access to VB6 is no more. I've also found that the other forums have all but gone silent on VB6 discussions.

I know folk want to keep going but here, it's dead Jim.

Maybe you can outsource this on Upwork or such?

by rofamarja

pared down to the minimum, this prints an empty page.

This discussion is closed to new replies.