CDC::Draw3dRect

调用该成员函数的绘制一个三维矩形。

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

参数

  • lpRect
    指定边框(以逻辑单位)。 通过指向 RECT 结构或此参数的 CRect 对象。

  • clrTopLeft
    指定三维矩形的顶部和左侧的颜色。

  • clrBottomRight
    指定三维矩形的底部和右侧的颜色。

  • x
    指定三维矩形的左上角的逻辑x坐标。

  • y
    指定三维矩形的左上角的逻辑y坐标。

  • cx
    指定三维矩形的宽度。

  • cy
    指定三维矩形的高度。

备注

矩形中绘制在 clrTopLeft 指定颜色的顶部和左侧和底部和右侧在 clrBottomRight指定的颜色。

示例

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));
}

要求

Header: afxwin.h

请参见

参考

CDC 类

层次结构图

RECT 结构

CRect选件类