Graphics.PageUnit problem...

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I have to do some WYSIWIG rendering.
Bacause I need exactly where is what and have the same output on the printer
I decided to change my Page unit to Inch.
As I was testing my first though was to draw read outline of some relevant
rectangle.

And here I had my 1st encouter with those infamouse Windows strangeness....
Even though I had set my line width to 0, GDI draw me 1 inch thick rectangle
borders...
What's that?
How could I fix that?

Below is a code sample:
=======================
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);

e.Graphics.PageUnit = GraphicsUnit.Inch;

using (Pen pen = new Pen(Color.Red, 0))
{
pen.Width = 0;
e.Graphics.DrawRectangle(Pens.Red, 0, 0, 8.5f, 11);
e.Graphics.DrawRectangle(Pens.Red, 1.5f, 1.25f, 5.5f, 8.5f);
}
}
 
Back
Top