Share via


CRgn::CreateRoundRectRgn

Creates a rectangular region with rounded corners that is stored in the CRgn object.

BOOL CreateRoundRectRgn(
   int x1,
   int y1,
   int x2,
   int y2,
   int x3,
   int y3 
);

Parameters

  • x1
    Specifies the logical x-coordinate of the upper-left corner of the region.

  • y1
    Specifies the logical y-coordinate of the upper-left corner of the region.

  • x2
    Specifies the logical x-coordinate of the lower-right corner of the region.

  • y2
    Specifies the logical y-coordinate of the lower-right corner of the region.

  • x3
    Specifies the width of the ellipse used to create the rounded corners.

  • y3
    Specifies the height of the ellipse used to create the rounded corners.

Return Value

Nonzero if the operation succeeded; otherwise 0.

Remarks

The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.

When an application has finished using a region created with the CreateRoundRectRgn function, it should select the region out of the device context and use the CGDIObject::DeleteObject member function to remove it.

Example

CRgn   rgnA, rgnB, rgnC;

VERIFY(rgnA.CreateRoundRectRgn( 50, 50, 150, 150, 30, 30 ));
VERIFY(rgnB.CreateRoundRectRgn( 200, 75, 250, 125, 50, 50 ));
VERIFY(rgnC.CreateRectRgn( 0, 0, 50, 50 ));

int nCombineResult = rgnC.CombineRgn( &rgnA, &rgnB, RGN_OR );
ASSERT( nCombineResult != ERROR && nCombineResult != NULLREGION );

CBrush brA, brB, brC;
VERIFY(brA.CreateSolidBrush( RGB(255, 0, 0) ));  
VERIFY(pDC->FillRgn( &rgnA, &brA));      // rgnA Red Filled

VERIFY(brB.CreateSolidBrush( RGB(0, 255, 0) ));  
VERIFY(pDC->FillRgn( &rgnB, &brB));      // rgnB Green Filled
VERIFY(brC.CreateSolidBrush( RGB(0, 0, 255) ));  // rgnC Blue
VERIFY(pDC->FrameRgn( &rgnC, &brC, 2, 2 ));

Requirements

Header: afxwin.h

See Also

Reference

CRgn Class

Hierarchy Chart

CRgn::CreateRectRgn

CRgn::CreateRectRgnIndirect

CreateRoundRectRgn

Other Resources

CRgn Members