Hi, I'm trying to print an image that my program draws.
The stange thing is this:
This code should generete 2 squares with equal size, but it doesn't. The red square is more wide than the black. Can anyone help me?Code:Private Sub printer_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles print.PrintPage e.Graphics.FillRectangle(Brushes.Black, marginLeft, 0, 300, 500) e.Graphics.DrawImage(img, marginLeft, 0) End Sub Function img() as Image Dim bm As New Bitmap(1000,1000) Dim gr As Graphics gr = Graphics.FromImage(bm) gr.FillRectangle(Brushes.Red, 0, 500, 300, 500) img = bm End Sub


Reply With Quote