用Win32实现类似MFC中Draw3dRect函数的功能!清高手指点!

解决方案 »

  1.   

    CDC::Draw3dRect
    void Draw3dRect( LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight );void Draw3dRect( int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight );ParameterslpRectSpecifies the bounding rectangle (in logical units). You can pass either a pointer to a RECT structure or a CRect object for this parameter.clrTopLeftSpecifies the color of the top and left sides of the three-dimensional rectangle.clrBottomRightSpecifies the color of the bottom and right sides of the three-dimensional rectangle.xSpecifies the logical x-coordinate of the upper-left corner of the three-dimensional rectangle.ySpecifies the logical y-coordinate of the upper-left corner of the three-dimensional rectangle.cxSpecifies the width of the three-dimensional rectangle.cySpecifies the height of the three-dimensional rectangle.不和MFC一样画吗
    不都要通过绘图环境CDC画的吗
      

  2.   

    void FillSolidRect(HDC hdc,int x, int y, int cx, int cy, COLORREF clr)
    {
    ::SetBkColor(hdc, clr);
    RECT rect;
    rect.left=x;
    rect.top=y;
    rect.right=x+cx;
    rect.bottom=y+cy;
    ::ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
    }void Draw3dRect(HDC hdc,int x, int y, int cx, int cy,
    COLORREF clrTopLeft, COLORREF clrBottomRight)
    {
    FillSolidRect(hdc,x, y, cx - 1, 1, clrTopLeft);
    FillSolidRect(hdc,x, y, 1, cy - 1, clrTopLeft);
    FillSolidRect(hdc,x + cx, y, -1, cy, clrBottomRight);
    FillSolidRect(hdc,x, y + cy, cx, -1, clrBottomRight);
    }
    void Draw3dRect(HDC hdc,RECT* lpRect,
    COLORREF clrTopLeft, COLORREF clrBottomRight)
    {
    Draw3dRect(hdc,lpRect->left, lpRect->top, lpRect->right - lpRect->left,
    lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight);
    }