Cannot get margins correct when printing

Hi There,

I have been trying to print a report and am getting nowhere with regard to getting the correct margins, pageunits etc for the printdocument.

The test code I have written below gives me really large margins on each side of the page. I have tried MarginBounds and PrintableArea. I have tried using millimeters, pixels, points and inches.

MainRectangleSize.Height = e.MarginBounds.Height
MainRectangleSize.Width = e.MarginBounds.Width
MainRectangle.X = e.MarginBounds.X
MainRectangle.Y = e.MarginBounds.Y
MainRectangle.Size = MainRectangleSize

I would really appreciate some help on getting the correct method of drawing a rectangle on the margins of a page.

Thanks

Shawn

[738 byte] By [ShawnvandenBerg] at [2007-12-25]