[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: blank page preview when trying to print an image


On Mon, 16 Sept 2024 at 15:54, Charles Bukowski <
charlesbukowski.italy@xxxxxxxxx> wrote:

> Hi, I am trying to print to a file, and maybe later to paper, a picture
> correctly displayed into a picturebox of a form.
> Printing should start after clicking a button on the same form.
> Unfortunately I get a blank page at runtime, without any warning at
> compilation time.
> This is the code I am using:
>
> Public Sub Button6_Click()
>  stampante1 = New Printer As "stampante1"
>  stampante1.Configure
>  stampante1.Print
> End
>
> Public Sub stampante1_Draw()
> Paint.Begin(PictureBox1.Picture)
> Paint.DrawPicture(PictureBox1.Picture, 100, 400)
> End
>
> I have attached system configuration.
> Any idea about what's wrong?
> Thank you
>

A Draw event happens inside an objects own Paint.Begin and Paint.End method
there is no need to use Paint.Begin again
your code is painting to the PictureBox.Picture not the Printer.

Public Sub stampante1_Draw()

  Paint.DrawPicture(PictureBox1.Picture, 100, 400)

End

should be all you need
Respects
BruceS

Follow-Ups:
Re: blank page preview when trying to print an imageBruce Steers <bsteers4@xxxxxxxxx>
References:
blank page preview when trying to print an imageCharles Bukowski <charlesbukowski.italy@xxxxxxxxx>