Reputation: 2876
please help me. I want to print some reports from .NET app. I read how to use PrintDocument class and Graphics object to draw my report. But i don`t know which units are used in methods, for example:
Protected Overrides Sub OnPrintPage(ByVal e As System.Drawing.Printing.PrintPageEventArgs)
MyBase.OnPrintPage(e)
Dim g As Graphics = e.Graphics
g.PageUnit = GraphicsUnit.Millimeter
Dim p As New Pen(Brushes.Red, 5)
g.DrawRectangle(p, 5, 5, g.VisibleClipBounds.Width - 10, g.VisibleClipBounds.Height - 10)
End Sub
in method:
Public Sub DrawRectangle(ByVal pen As System.Drawing.Pen, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single)
parameters x,y,width,height are in pixels,millimeters,inches or what?
I try to find answer on google but founded nothing. I am completely confused.
Thanks
Upvotes: 2
Views: 2465
Reputation: 190897
Check the PageUnit
property.
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.pageunit.aspx
which could be any one (except World
) of these:
http://msdn.microsoft.com/en-us/library/system.drawing.graphicsunit.aspx
Upvotes: 1