[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 16:30, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

>
>
> 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
>

actually i am not sure if Paint.DrawPicture(PictureBox1.Picture, 100, 400)
will produce what you want.

the wiki shows it more like this...

Public Sub MyPrinter_Draw()

  Paint.Scale(Paint.Width / MyPrinter.PaperWidth, Paint.Height /
MyPrinter.PaperHeight)
  ...

End
https://gambaswiki.org/wiki/howto/print

BruceS

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