How do I magnify the printer output image in Visual Basic 2012?

asked 2021-05-04T00:16:28.733+00:00
agjim000 1 Reputation point

I created a graphics form called MyCanvas and created an Image1 on MyCanvas. Margins are all set to zero (0) as follows:
MyCanvas.PrintForm1.Form.Top = 0
MyCanvas.PrintForm1.Form.Left = 0
MyCanvas.PrintForm1.Form.Bottom = 0
MyCanvas.PrintForm1.Form.Right = 0

The on-screen image looked great! Zero margins and the image is sized correctly.

The margins for the printer are set to zero as follows:
MyCanvas.FormBorderStyle = 0
MyCanvas.PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Top = 0
MyCanvas.PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Bottom = 0
MyCanvas.PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Left = 0
MyCanvas.PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Right = 0

The printed output has margins top = 11 and left = 13 (both should be zeros) and the image is too large (approx'ly x1.2). There are two read-only printer property values that seem to be responsible for the non-zero margins as follows:
MyCanvas.PrintForm1.PrinterSettings.DefaultPageSettings.HardMarginX =13
= 11

I can't figure out how to get the printed image to have zero margins for the top and left, and the image size to x1.0 instead of x1.2.

Thanks to anyone who can fix this! I have toiled with this for months.

An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
1,825 questions
{count} votes