Set the pageunit property in the PrintPage event - I have my data stored in
inches, so I set it like this:
e.Graphics.PageUnit = GraphicsUnit.Inch; // or whatever unit you want.
If you do this, you don't have to worry about the DPI of the printer.
"Chris Dunaway" wrote:
> When using PrintDocument to print something, if I check the PageBounds
> property of the PrintPageEventArgs object, it shows the rectangle to be
> 850 x 1100, or 100 dpi. But when I check the value of the
> PrintDocument.PrinterSettings.DefaultPageSettings.PrinterResolution.X
> property for the printer in question it shows 600 dpi?
>
> If I perform the following:
>
> e.Graphics.FillRectangle(Brushes.Gainsboro, 40, 40, 500, 100);
>
> in the PrintPage event, I get a gray rectangle that is exactly 5 inches
> by 1 inch, or 100 dpi.
>
> What is the relationship of the rectangle returned by the PageBounds
> property to the dpi of the printer?
>
> I tried changing the resolution of the printer but it still seemed to
> print at 100 dpi.
>
> Can anyone clear this up for me?
>
> Thanks
>
>
|