Partager via


CDrawingManager::DrawShadow

Draws a shadow for a rectangular area.

BOOL DrawShadow(
   CRect rect,
   int nDepth,
   int iMinBrightness = 100,
   int iMaxBrightness = 50,
   CBitmap* pBmpSaveBottom = NULL,
   CBitmap* pBmpSaveRight = NULL,
   COLORREF clrBase = (COLORREF)-1,
   BOOL bRightShadow = TRUE 
);

Parameters

  • [in] rect
    A rectangular area in your application. The drawing manager will draw a shadow underneath this area.

  • [in] nDepth
    The width and height of the shadow.

  • [in] iMinBrightness
    The minimum brightness of the shadow.

  • [in] iMaxBrightness
    The maximum brightness of the shadow.

  • [in] pBmpSaveBottom
    A pointer to a bitmap that contains the image for the bottom part of the shadow.

  • [in] pBmpSaveRight
    A pointer to a bitmap that contains the image for the shadow that is drawn on the right side of the rectangle.

  • [in] clrBase
    The color of the shadow.

  • [in] bRightShadow
    A Boolean parameter that indicates how the shadow is drawn. If bRightShadow is TRUE, DrawShadow draws a shadow on the right side of the rectangle.

Return Value

Nonzero if successful; otherwise 0.

Remarks

You can provide two valid bitmaps for the bottom and right shadows by using the parameters pBmpSaveBottom and pBmpSaveRight. If these CBitmap objects have an attached GDI object, DrawShadow will use those bitmaps as the shadows. If the CBitmap parameters do not have an attached GDI object, DrawShadow draws the shadow and attaches the bitmaps to the parameters. In future calls to DrawShadow, you can provide these bitmaps to speed up the drawing process. For more information about the CBitmap class and GDI objects, see Graphic Objects.

If either of these parameters is NULL, DrawShadow will automatically draw the shadow.

If you set bRightShadow to FALSE, the shadow will be drawn underneath and to the left of the rectangular area.

Example

The following example demonstrates how to use the DrawShadow method of the CDrawingManager class. This code snippet is part of the Prop Sheet Demo sample.

// CDC* pDC 
    // CRect rectHeader
    CDrawingManager dm (*pDC);
    // Draw a shadow for a rectangular area. 
    // second parameter is the depth of the shadow
    dm.DrawShadow (rectHeader, 2);  

Requirements

Header: afxdrawmanager.h

See Also

Reference

CDrawingManager Class

Hierarchy Chart