次の方法で共有


CDC::Draw3dRect

3D の四角形を描画するには、このメンバー関数を呼び出します。

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
    3D の四角形の上端および左側の色を指定します。

  • clrBottomRight
    3D の四角形の下側と右側の色を指定します。

  • x
    3D の四角形の左上隅の論理的な x 座標を指定します。

  • y
    3D の四角形の左上隅の論理 y 座標を指定します。

  • cx
    3D の四角形の幅を指定します。

  • cy
    3D の四角形の高さを指定します。

解説

四角形は 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));
}

必要条件

ヘッダー: afxwin.h

参照

関連項目

CDC クラス

階層図

RECT 構造体

CRect クラス