The RoundRect function draws a rectangle with rounded corners.
Syntax
BOOL RoundRect(
HDC hdc,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3
);
Parameters
hdc- Handle to the device context.
x1- The x-coordinate of the upper-left corner of the rectangle.
y1- The y-coordinate of the upper-left corner of the rectangle.
x2- The x-coordinate of the lower-right corner of the rectangle.
y2- The y-coordinate of the lower-right corner of the rectangle.
x3- The width of the ellipse that is used to draw the rounded corners.
y3- The height of the ellipse that is used to draw the rounded corners.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
This function draws a rectangle with rounded corners using the current pen. The corners are rounded by using ellipses whose widths and heights are specified by the x3 and y3 parameters, respectively.
The rectangle is defined by the two points (x1, y1) and (x2, y2). The x3 and y3 parameters specify the width and height of the circles that define the rounded corners. The center of the circles are located at the corners of the rectangle before rounding.
If x3 and y3 are both zero, a rectangle with sharp corners is drawn.
If x3 or y3 is negative, the behavior is undefined.
The RoundRect function uses the current pen to draw the rectangle's border. It does not draw the corners themselves, but rather uses ellipses to define their curvature.
Requirements
| Component | Value |
|---|---|
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | wingdi.h (include Windows.h) |
| Library | GDI32.lib |
| DLL | GDI32.dll |