HRGN CreateRoundRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, nWidthEllipse, nHeightEllipse) | |||||
int nLeftRect; | /* x-coordinate upper-left corner of region | */ | |||
int nTopRect; | /* y-coordinate upper-left corner of region | */ | |||
int nRightRect; | /* x-coordinate lower-right corner of region | */ | |||
int nBottomRect; | /* y-coordinate lower-right corner of region | */ | |||
int nWidthEllipse; | /* height of ellipse for rounded corners | */ | |||
int nHeightEllipse; | /* width of ellipse for rounded corners | */ |
The CreateRoundRectRgn function creates a rectangular region with rounded corners.
nLeftRect
Specifies the logical x-coordinate of the upper-left corner of the region.
nTopRect
Specifies the logical y-coordinate of the upper-left corner of the region.
nRightRect
Specifies the logical x-coordinate of the lower-right corner of the region.
nBottomRect
Specifies the logical y-coordinate of the lower-right corner of the region.
nWidthEllipse
Specifies the width of the ellipse used to create the rounded corners.
nHeightEllipse
Specifies the height of the ellipse used to create the rounded corners.
The return value is the handle of the region if the function is successful. Otherwise, it is NULL.
The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.
When it has finished using a region created by CreateRoundRectRgn, an application should remove the region by using the DeleteObject function.
The following example uses the CreateRoundRectRgn function to create a region, selects the region into a device context, and then uses the PaintRgn function to display the region:
HRGN hrgn;
int nEllipWidth = 10;
int nEllipHeight = 30;
hrgn = CreateRoundRectRgn(10, 10, 110, 110,
nEllipWidth, nEllipHeight);
SelectObject(hdc, hrgn);
PaintRgn(hdc, hrgn);
CreateRectRgn, CreateRectRgnIndirect, DeleteObject, PaintRgn