Progress control with Text

 Download
Source Code and Example Project.

Latest Changes (Jeremy Davis)
26th May 1998

This is a simple CProgressCtrl derived class that allows text
to be displayed on top of the progress bar in much the same way
as many "Setup" programs display the progress of long
operations.

The control is extremely simple and allows the same operations
as a standard CProgressCtrl, as well as:

	void SetShowText(BOOL bShow);

which determines whether or not the text for the control will
be displayed during updates. To set the text to be displayed use
the standard CWnd::SetWindowText.
If you call SetShowText(TRUE)
but do not specify any window text using CWnd::SetWindowText,
then the percentage fraction of progress will be displayed as
default.

To use the control, just include a CProgressCtrl in your app
as per usual (either dynamically or by using a dialog template)
and change the variable type from CProgressCtrl to
CTextProgressCtrl. (Make sure you include TextProgressCtrl.h)

At present the progress is only displayed as a smooth bar.
(This may be changed in the future versions.)

Acknowledgements
Thanks to Keith Rule for his CMemDC class.

Modifications
26 May 1998 : Jeremy
Davis
added SetForeColour,
SetBkColour,
SetTextForeColour, SetTextBkColour, GetForeColour, GetBkColour, GetTextForeColour, GetTextBkColour.

void SetForeColour(COLORREF
col)
Sets the bar colour of the progress bar.
void SetBkColour(COLORREF
col)
Sets the background colour of the progress bar.
void
SetTextForeColour(COLORREF col)
Sets the colour of the text when the bar is not
covering it.
void
SetTextBkColour(COLORREF col)
Set the colour of the text when the bar is covering
it.
COLORREF GetForeColour() Returns the bar colour of the progress bar.
COLORREF GetBkColour() Returns the background colour of the progress bar.
COLORREF
GetTextForeColour()
Returns the colour the the text when the bar is not
covering it.
COLORREF GetTextBkColour() Returns the colour of the text when the bar is
covering it.

Last updated: 30 May 1998

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read