【发布时间】:2009-08-07 13:59:38
【问题描述】:
请帮助我。我想从 .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 的单位是像素、毫米、英寸还是什么?
我试图在谷歌上找到答案,但一无所获。 我完全糊涂了。
谢谢
【问题讨论】:
-
我更改了代码,但 g.VisibleClipBounds.Width 返回 799.333,it
s too much pro A4 page if its 以毫米为单位 -
Cicik,如果您对代码进行了更改,请将它们标记为这样。 GraphicsUnit.Millimeter 有帮助吗?
-
好的,以后我会标记更改,没有毫米没有帮助。矩形总是超出 apge。