A rectangle is a four-sided polygon whose opposing sides are parallel and equal in length. Although an application can draw a rectangle by calling the Polygon function, supplying the coordinates of each corner, the Rectangle function provides a simpler method. This function requires only the coordinates for the upper left and the lower right corners. When an application calls the Rectangle function, the system draws the rectangle, excluding the right and lower sides if no world transformation is set for the given device context.
If a world transformation has been set by using the SetWorldTransform or ModifyWorldTransform function, the system includes the right and lower edges.
In addition to drawing a traditional rectangle, you can draw rectangles with rounded corners. The RoundRect function requires that the application supply the coordinates of the lower left and upper right corners, as well as the width and height of the ellipse used to round each corner.
The Win32 API also provides three functions that applications can use to manipulate rectangles, described as follows.
Function | Description |
---|---|
FillRect | Repaints the interior of a rectangle. |
FrameRect | Redraws the sides of a rectangle. |
InvertRect | Inverts the colors that appear within the interior of a rectangle. |