Gradient Progress control

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Gradient Progress Control (7961 bytes)  Download Source Code
and Example

Development Environment: VC5, 95

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 customize the
colors and toggle the percentage caption’s visibility. 

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
ClassWizard to DDX_control it.  The actual code for the progress control is located
in GradientProgressCtrl.h and GradientProgressCtrl.cpp. I haven’t fully tested it’s
robustness, although I don’t suspect that it will fail miserably.  Most of the work
happens in the DrawGradient(…) function, which also uses Keith Rule’s MemDC 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.

I hope someone gives it a good home :).  Please let me know of any problems or
improvements.  Thanks and good luck.

Member Set Functions

	void SetTextColor(COLORREF color)           // Set the percentage text color
	void SetBkColor(COLORREF color)             // Set background color
	void SetStartColor(COLORREF color)          // Set starting color
	void SetEndColor(COLORREF color)            // Set ending color
	void ShowPercent(BOOL bShowPercent = TRUE)  // Show the percent caption?

Member Get Functions

	COLORREF GetTextColor(void)
	COLORREF GetBkColor(void)
	COLORREF GetStartColor(void)
	COLORREF GetEndColor(void)

 

Last updated: 18 May 1998

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read