Using a printdocument class I want to print a rectangle in the middle of an A4 page that is 3 x 5 inches.
I have used the following code in the PrintDocument_PrintPage event method but the box is massive and I can't seem to calculate how to convert inches into dots/pixels. Can somebody help me please.
I have used the following code in the PrintDocument_PrintPage event method but the box is massive and I can't seem to calculate how to convert inches into dots/pixels. Can somebody help me please.
VB.NET:
Private Sub m_Document_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles m_Document.PrintPage
dim iHeight as integer = 3
dim iWidth as integer = 5
dim Rect as new Rectangle(100, 100, iWidth * e.Graphics.DpiX, iHeight * e.Graphics.DpiY)
e.Graphics.DrawRectangle(Pens.Black, Rect)
end sub