Chris S. wrote:
Here's a starter for 10 - I have the following simple code:
private void panel1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Color.Blue),
this.panel1.ClientRectangle);
}
Where a panel is on a form. I've always had to alter the 'rect'
variable as it doesn't draw the border correctly, the right and bottom
lines aren't in view. Any ideas why this is?
It looks like there's a difference in meaning between the Rectangles.
This is easier to see if you draw very small controls and look at them
magnified in Paint or such.
- If you have a Panel with Size (2,2) then it does actually have a size
of 2 pixels by 2 pixels
- But if you do a DrawRectangle with a new Rectangle(0, 0, 2, 2) what
you actually get is what I would call a *three by three* rectangle. I
_guess_ this is because the 'zeroth' pixel is counted as well.
So you receive from ClientRectangle the first kind of Rectangle, which
then gets drawn 'one bigger' by DrawRectangle. Whether this is by
design or bug, I couldn't say. The comically auto-generated help is
no... um... help.
--
Larry Lard
Replies to group please