void SetRectRgn(hrgn, nLeftRect, nTopRect, nRightRect, nBottomRect) | |||||
HRGN hrgn; | /* handle of region, */ | ||||
int nLeftRect; | /* x-coordinate top-left corner of rectangle | */ | |||
int nTopRect; | /* y-coordinate top-left corner of rectangle | */ | |||
int nRightRect; | /* x-coordinate bottom-right corner of rectangle | */ | |||
int nBottomRect; | /* y-coordinate bottom-right corner of rectangle | */ |
The SetRectRgn function changes the given region into a rectangular region with the specified coordinates.
hrgn
Identifies the region.
nLeftRect
Specifies the x-coordinate of the upper-left corner of the rectangular region.
nTopRect
Specifies the y-coordinate of the upper-left corner of the rectangular region.
nRightRect
Specifies the x-coordinate of the lower-right corner of the rectangular region.
nBottomRect
Specifies the y-coordinate of the lower-right corner of the rectangular region.
This function does not return a value.
Applications can use this function instead of the CreateRectRgn function to avoid allocating more memory from the GDI heap. Because the memory allocated for the hrgn parameter is reused, no new allocation is performed.
The following example uses the CreateRectRgn function to create a rectangular region and then calls the SetRectRgn function to change the region coordinates:
HRGN hrgn;
hrgn = CreateRectRgn(10, 10, 30, 30);
PaintRgn(hdc, hrgn);
SetRectRgn(hrgn, 50, 50, 150, 200);
PaintRgn(hdc, hrgn);
DeleteObject(hrgn);