nearly every time I use Graphics.DrawRectangle
or Graphics.FillRectangle
(the int
versions) I seem to miss the pixels on the right and
The rectangle in both of the Graphics methods in your question is bounded by (x, y)
in the upper left and (x + width - 1, y + height - 1)
in the lower right. This is a consequence of specifying width and height, rather than the lower right point.
When you're calculating the width and height from two points, you have remember to include the origin pixel by adding 1 to the difference.
For example, say you want to fill a Rectangle from point (5, 5) to point (10, 20). The width of the rectangle is 6, not 5. The height of the rectangle is 16, not 15.