2

请帮我。我想从 .NET 应用程序打印一些报告。我阅读了如何使用 PrintDocument 类和 Graphics 对象来绘制我的报告。但我不知道方法中使用了哪些单位,例如:

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

在方法中:

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)

参数 x,y,width,height 的单位是像素、毫米、英寸还是什么?

我试图在谷歌上找到答案,但什么也没找到。我完全糊涂了。

谢谢

4

1 回答 1

1

检查PageUnit物业。

http://msdn.microsoft.com/en-us/library/system.drawing.graphics.pageunit.aspx

可以是以下任何一项(除了World):

http://msdn.microsoft.com/en-us/library/system.drawing.graphicsunit.aspx

于 2009-08-07T14:02:55.163 回答