Partager via


CDrawingManager::FillGradient

Fills a rectangular area with the specified color gradient.

void FillGradient(
   CRect rect,
   COLORREF colorStart,
   COLORREF colorFinish,
   BOOL bHorz = TRUE,
   int nStartFlatPercentage = 0,
   int nEndFlatPercentage = 0
);

Parameters

  • [in] rect
    The rectangular area to fill.

  • [in] colorStart
    The first color for the gradient.

  • [in] colorFinish
    The final color for the gradient.

  • [in] bHorz
    A Boolean parameter that specifies whether FillGradient should draw a horizontal or vertical gradient.

  • [in] nStartFlatPercentage
    The percentage of the rectangle that FillGradient fills with colorStart before it starts the gradient.

  • [in] nEndFlatPercentage
    The percentage of the rectangle that FillGradient fills with colorFinish after it finishes the gradient.

Example

The following example demonstrates how to use the FillGradient method of the CDrawingManager class. This code snippet is part of the MS Office 2007 Demo sample.

            // CRect rectScreen
            // CDrawingManager dm
            dm.FillGradient(rectScreen, RGB(114, 125, 152), RGB(178, 185, 202), TRUE);

Requirements

Header: afxdrawmanager.h

See Also

Reference

CDrawingManager Class

Hierarchy Chart