BOOL RoundRect(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, nEllipseWidth, nEllipseHeight) | |||||
HDC hdc; | /* handle of device context | */ | |||
int nLeftRect; | /* x-coordinate upper-left corner | */ | |||
int nTopRect; | /* y-coordinate upper-left corner | */ | |||
int nRightRect; | /* x-coordinate lower-right corner | */ | |||
int nBottomRect; | /* y-coordinate lower-right corner | */ | |||
int nEllipseWidth; | /* width of ellipse for rounded corners | */ | |||
int nEllipseHeight; | /* height of ellipse for rounded corners | */ |
The RoundRect function draws a rectangle with rounded corners, using the current pen. The interior of the rectangle is filled by using the current brush.
hdc
Identifies the device context.
nLeftRect
Specifies the logical x-coordinate of the upper-left corner of the rectangle.
nTopRect
Specifies the logical y-coordinate of the upper-left corner of the rectangle.
nRightRect
Specifies the logical x-coordinate of the lower-right corner of the rectangle.
nBottomRect
Specifies the logical y-coordinate of the lower-right corner of the rectangle.
nEllipseWidth
Specifies the width, in logical units, of the ellipse used to draw the rounded corners.
nEllipseHeight
Specifies the height, in logical units, of the ellipse used to draw the rounded corners.
The return value is nonzero if the function is successful. Otherwise, it is zero.
The figure this function draws extends up to but does not include the right and
bottom coordinates. This means that the height of the figure is nBottomRect –
nTopRect and the width of the figure is nRightRect – nLeftRect.
Both the width and the height of a rectangle must be greater than 2 units and less than 32,767 units.
The following example uses a RECT structure to store the coordinates used by the RoundRect function:
HDC hdc;
RECT rc = { 10, 10, 180, 140 };
int iEllipseWidth, iEllipseHeight;
iEllipseWidth = 20;
iEllipseHeight = 40;
RoundRect(hdc, rc.left, rc.top, rc.right, rc.bottom,
iEllipseWidth, iEllipseHeight);