2.10.1 Rectangles

The Rectangle function draws a rectangle, using the current pen. The RoundRect function also draws a rectangle, but with rounded rather than square corners.

When GDI draws a rectangle, it uses four arguments. The first two arguments specify the upper-left corner of the rectangle. The last two arguments do not actually specify part of the rectangle; they specify the point adjacent to the lower-right corner. For example, if the first point is specified by (x1, y1) and the second point is specified by (x2, y2), the rectangle's upper-left corner will be (x1, y1) and the lower-right corner will be (x2 – 1, y2 – 1).