I have to do some WYSIWIG rendering.
Because I need to know exactly where is what and have to have the same
output on both the screen and the printer I decided to change my Page unit
to Inches.
As I was testing my first thought was to draw red outline of some relevant
rectangle.
And here I had my 1st encouter with those infamous Windows strangeness....
Even though I had set my line width to 0, GDI+ draw 1 inch thick
rectangles...
What's that?
How could I fix that?
Below is a code sample showing the problem,
just try it: big rectangle:
==========================
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);
}
}