.NET Rectangle Off By 1
Posted
by roygbiv
on Stack Overflow
See other posts from Stack Overflow
or by roygbiv
Published on 2010-04-07T20:40:34Z
Indexed on
2010/04/07
20:43 UTC
Read the original article
Hit count: 202
After working with the .NET GDI+ Rectangle object, I've noticed that if I create a rectangle that is X:0 * Y:0 * Width:100 * Height:100, the Right
and Bottom
properties are set to 100, 100. Shouldn't this be 99, 99? 0 - 99 is 100 pixels. 0 - 100 is 101 pixels.
FWIW, the documentation does say the right is computed by x + width
and the bottom is y + height
, but is that correct? Perhaps "correct" doesn't matter here as long it's consistent?
All I know is that it is somewhat (read... very) annoying!
© Stack Overflow or respective owner