Print Preview PictureBox Image

SeanPress 206 Reputation points
2021-02-09T23:58:23.867+00:00

I have created a form in Visual Basic including a PictureBox with a .jpg image & size set to zoom. The actual image size is A4, bit it sits perfectly within the picture box when the size is set to zoom, I have added a button for print & print preview, a print document & print preview dialog.

When I debug everything works ok but the printed page is off center & I lose part of the right hand side & bottom of the image. It is the same with the print preview, the print preview opens ok, I can change the print preview to full screen & the image resizes, but again, the preview of the image is off center to the right & bottom.

I’m new to Visual Basic, can anyone tell me what would cause the image to be off center & how I can fix the issue?

Developer technologies Visual Studio Debugging
Developer technologies Visual Studio Setup
Developer technologies .NET Other
Developer technologies VB
Developer technologies Visual Studio Other
{count} votes

Accepted answer
  1. Xingyu Zhao-MSFT 5,381 Reputation points
    2021-02-11T02:49:06.393+00:00

    Hi @SeanPress ,

    The actual image size is A4... the printed page is off center & I lose part of the right hand side & bottom of the image

    Conside changing the location of picture.

        Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage  
            e.Graphics.DrawImage(PictureBox1.Image, 0, 0)  
        End Sub  
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.