Download demo project - 47 Kb
Download source files - 6 Kb
Introduction
This is a simple class to display a gradient fill progress control. It works just like the normal
progress control. The main enhancements are that you can define the start and end colors and toggle
the percentage caption's visibility. It supports both horizontal and vertical progress control styles.
The sample application shows both types of controls on a single dialog-based application.
The control can be incorporated into a project like any other CProgressCtrl
-derived
control. Either create the control manually, subclass an existing CProgressCtrl
, or use
the ClassWizard to DDX_control it. The actual code for the progress control is located in
GradientProgressCtrl.h
and GradientProgressCtrl.cpp
. Most of the work
happens in the DrawGradient(...)
function, which also uses Keith Rule's CMemDC
class. The sample project also uses Chris Maunder's ColourPicker
. Both of these classes
are included in the sample project and can be downloaded elsewhere at this site.
It is derived from CProgressCtrl
so all standard CProgressCtrl
functions
are available. Additional functions are listed below.
Please let me know of any problems or improvements. Thanks and good luck.
Member Set Functions
void SetTextColor(const COLORREF& color)
void SetBkColor(const COLORREF& color)
void SetStartColor(const COLORREF& color)
void SetEndColor(const COLORREF& color)
void ShowPercent(BOOL bShowPercent = TRUE)
Member Get Functions
const COLORREF GetTextColor(void)
const COLORREF GetBkColor(void)
const COLORREF GetStartColor(void)
const COLORREF GetEndColor(void)
const BOOL GetShowPercent()