SoftechSoftware homepage
SoftechSoftware Email
Abstract
CProgressCtrlST
is a class derived from MFC CProgressCtrl class.
With this class your applications can have progress bars using bitmaps as seen in many modern installation programs and games!
CProgressCtrlST features:
- Easy to use
- Standard CProgressCtrl methods
- Support for 256+ colors bitmaps
- Support for negative ranges
- Support for vertical progress controls
- Full source code included!
- Cost-less implementation in existing applications
How to integrate CProgressCtrlST in your application
In your project include the following files:
- ProgressCtrlST.h
- ProgressCtrlST.cpp
You also need a bitmap that will be used to draw the progress bar. For example include in your project
Tile.bmp
and call it
IDB_TILE. With dialog editor create a progress control called, for example,
IDC_TILED.
Then create a member variable for this progress control:
CProgressCtrlST m_progressTiled;
Now attach the progress control to
CProgressCtrlST. For dialog-based applications, in your
OnInitDialog:
CDialog::OnInitDialog();
m_progressTiled.SubclassDlgItem(IDC_TILED, this);
Or in your DoDataExchange:
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TILED, m_progressTiled);
The control will have the same default range and start position as in the base MFC class
CProgressCtrl. These values can be modified using the same methods of the
base class such as, for example,
SetRange
or
SetPos
. At this moment
OffsetPos
is not supported.
By default the control will draw itself just like a normal progress bar. A bitmap can be assigned to get a progress bar showing it instead of normal standard blocks!
This bitmap will be tiled to paint the necessary portion of the progress bar; it will not be
shrinked or enlarged in any manner.
Assign a bitmap to the progress bar:
m_progressTiled.SetBitmap(IDB_TILE);
Your progress control is now a
CProgressCtrlST!
Class methods
SetBitmap
Sets the bitmap to use to draw the progress bar.
DWORD SetBitmap(int nBitmap, BOOL bRepaint = TRUE)
SetBitmap
Sets the bitmap to use to draw the progress bar.
DWORD SetBitmap(HBITMAP hBitmap, BOOL bRepaint = TRUE)
SetRange
Sets the upper and lower limits of the progress bar control's range
and redraws the bar to reflect the new ranges.
void SetRange(int nLower, int nUpper)
SetStep
Specifies the step increment for a progress bar control.
The step increment is the amount by which a call to StepIt increases
the progress bar's current position.
int SetStep(int nStep)
SetPos
Sets the progress bar control's current position as specified by nPos
and redraws the bar to reflect the new position.
The position of the progress bar control is not the physical location on the screen,
but rather is between the upper and lower range indicated in SetRange.
int SetPos(int nPos)
StepIt
Advances the current position for a progress bar control by the step increment
and redraws the bar to reflect the new position.
The step increment is set by the SetStep method.
int StepIt()
OnDrawText
This function is called each time the progress bar is redrawn.
It is a virtual function to let derived classes do custom drawing.
The default implementation does nothing.
virtual void OnDrawText(CDC* pDC, int nPercentage, CRect rcCtrl, CRect rcProgress, BOOL bVertical)
GetVersionI
Returns the class version as a short value.
static short GetVersionI()
GetVersionC
Returns the class version as a string value.
static LPCTSTR GetVersionC()
History
- v1.1 (27/August/2002)
Class name changed to CProgressCtrlST
Added support for vertical progress controls
- v1.0 (01/January/1999)
First release
Disclaimer
THE SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED "AS IS" AND WITHOUT ANY WARRANTIES WHETHER EXPRESSED OR IMPLIED.
NO REPONSIBILITIES FOR POSSIBLE DAMAGES OR EVEN FUNCTIONALITY CAN BE TAKEN.
THE USER MUST ASSUME THE ENTIRE RISK OF USING THIS SOFTWARE.