CDC::RoundRect 

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

BOOL RoundRect( LPCRECT lpRect, POINT point );

Return Value

Nonzero if the function is successful; otherwise 0.

Parameters

x1

Specifies the x-coordinate of the upper-left corner of the rectangle (in logical units).

y1

Specifies the y-coordinate of the upper-left corner of the rectangle (in logical units).

x2

Specifies the x-coordinate of the lower-right corner of the rectangle (in logical units).

y2

Specifies the y-coordinate of the lower-right corner of the rectangle (in logical units).

x3

Specifies the width of the ellipse used to draw the rounded corners (in logical units).

y3

Specifies the height of the ellipse used to draw the rounded corners (in logical units).

lpRect

Specifies the bounding rectangle in logical units. You can pass either a CRect object or a pointer to a RECT structure for this parameter.

point

The x-coordinate of point specifies the width of the ellipse to draw the rounded corners (in logical units). The y-coordinate of point specifies the height of the ellipse to draw the rounded corners (in logical units). You can pass either a POINT structure or a CPoint object for this parameter.

Remarks

Draws a rectangle with rounded corners using the current pen. The interior of the rectangle is filled using the current brush.

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 y2y1 and the width of the figure is x2x1. Both the height and the width of the bounding rectangle must be greater than 2 units and less than 32,767 units.

Example

void CMyView::OnDraw(CDC* pDC)
{
   // create and select a solid blue brush
   CBrush brushBlue(RGB(0, 0, 255));
   CBrush* pOldBrush = pDC->SelectObject(&brushBlue);

   // create and select a thick, black pen
   CPen penBlack;
   penBlack.CreatePen(PS_SOLID, 3, RGB(0, 0, 0));
   CPen* pOldPen = pDC->SelectObject(&penBlack);

   // get our client rectangle
   CRect rect;
   GetClientRect(rect);

   // shrink our rect 20 pixels in each direction
   rect.DeflateRect(20, 20);

   // Draw a thick black rectangle filled with blue
   // corners rounded at a 17-unit radius. Note that
   // a radius of three or less is not noticable because
   // the pen is three units wide.
   pDC->RoundRect(rect, CPoint(17, 17));

   // put back the old objects
   pDC->SelectObject(pOldBrush);
   pDC->SelectObject(pOldPen);
}

CDC OverviewClass MembersHierarchy Chart

See Also   CDC::Rectangle, ::RoundRect, CRect, RECT, POINT, CPoint