views:

72

answers:

1

Hello,

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

+1  A: 

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

Daniel A. White