Print Preview PictureBox Image

SeanPress 166 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?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,525 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,764 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,628 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
958 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
989 questions
{count} votes

Accepted answer
  1. Xingyu Zhao-MSFT 5,356 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