Share via


CDC::Draw3dRect

Call this member function to draw a three-dimensional rectangle.

void Draw3dRect(
   LPCRECT lpRect,
   COLORREF clrTopLeft,
   COLORREF clrBottomRight 
);
void Draw3dRect(
   int x,
   int y,
   int cx,
   int cy,
   COLORREF clrTopLeft,
   COLORREF clrBottomRight 
);

Parameters

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

  • clrTopLeft
    Specifies the color of the top and left sides of the three-dimensional rectangle.

  • clrBottomRight
    Specifies the color of the bottom and right sides of the three-dimensional rectangle.

  • x
    Specifies the logical x-coordinate of the upper-left corner of the three-dimensional rectangle.

  • y
    Specifies the logical y-coordinate of the upper-left corner of the three-dimensional rectangle.

  • cx
    Specifies the width of the three-dimensional rectangle.

  • cy
    Specifies the height of the three-dimensional rectangle.

Remarks

The rectangle will be drawn with the top and left sides in the color specified by clrTopLeft and the bottom and right sides in the color specified by clrBottomRight.

Example

void CDCView::Draw3dRect(CDC* pDC)
{
   // get the client area
   CRect rect;
   GetClientRect(rect);

   // shrink our rect 20 pixels on all sides
   rect.DeflateRect(20, 20);

   // draw a rectangle with red top and left sides, and
   // green right and bottom sides.
   pDC->Draw3dRect(rect, RGB(255, 0, 0), RGB(0, 255, 0));

   // This call to the four-integer override would draw
   // the same rectangle with a little less convenience:

   // pDC->Draw3dRect(rect.left, rect.top, rect.Width(), rect.Height(),
   //    RGB(255, 0, 0), RGB(0, 255, 0));
}

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

RECT Structure

CRect Class

Other Resources

CDC Members