V
VR
Also,
I noticed that PageBounds and PageMargins rectangles are
not properly representing the page size (or it could be
the printer). The code below draws a rectangle on the
screen which isn't really centered, but rather shifted to
the right of the page:
private void OnPrintPage
(
object sender,
PrintPageEventArgs e) float fTop
)
{
float x = e.MarginBounds.Left;
float y = e.MarginBounds.Top;
float height = e.MarginBounds.Height;
float width = e.MarginBounds.Width;
Pen oPen3 = new Pen(Brushes.Black, 2.0F);
e.Graphics.DrawRectangle(oPen3, x, y, width, height);
e.HasMorePages = false;
}
Also, if I were to do the same with PageBounds rectangle,
should I be able to see it on the page, or should it be
drawn right at the very edge of the page?
When I look at PageBounds in debugger, I see left and top
set to 0 and width and height are 850 and 1100. I assumed
that a unit represents 1/100 of an inch, and therefore,
the rectangle should be right at the edge of the page --
probably shouldn't even come out.
But it does come out, and top left corner of the rectangle
is offset by about a 1/6 inch from top and left sides of
the page... The right and the bottom of the rectangle
don't even appear on the page.
So, I kept printing rectangles until they started
appearing in full on the page and it seems that it I have
to offset the right and the bottom sides of rectangle by
about 30-35 units from the right and the bottom (3/10
inch?).
Does anybody have a clue what I am talking about? (I jsut
re-read what I came up with and I barely understand
myself)
Thanks for any suggestions.
VR
I noticed that PageBounds and PageMargins rectangles are
not properly representing the page size (or it could be
the printer). The code below draws a rectangle on the
screen which isn't really centered, but rather shifted to
the right of the page:
private void OnPrintPage
(
object sender,
PrintPageEventArgs e) float fTop
)
{
float x = e.MarginBounds.Left;
float y = e.MarginBounds.Top;
float height = e.MarginBounds.Height;
float width = e.MarginBounds.Width;
Pen oPen3 = new Pen(Brushes.Black, 2.0F);
e.Graphics.DrawRectangle(oPen3, x, y, width, height);
e.HasMorePages = false;
}
Also, if I were to do the same with PageBounds rectangle,
should I be able to see it on the page, or should it be
drawn right at the very edge of the page?
When I look at PageBounds in debugger, I see left and top
set to 0 and width and height are 850 and 1100. I assumed
that a unit represents 1/100 of an inch, and therefore,
the rectangle should be right at the edge of the page --
probably shouldn't even come out.
But it does come out, and top left corner of the rectangle
is offset by about a 1/6 inch from top and left sides of
the page... The right and the bottom of the rectangle
don't even appear on the page.
So, I kept printing rectangles until they started
appearing in full on the page and it seems that it I have
to offset the right and the bottom sides of rectangle by
about 30-35 units from the right and the bottom (3/10
inch?).
Does anybody have a clue what I am talking about? (I jsut
re-read what I came up with and I barely understand
myself)
Thanks for any suggestions.
VR