SoftechSoftware homepage
SoftechSoftware Email
Abstract
You need GDI+ installed to use this
control.
CCylinderProgressControlST
is a class derived from
MFC CProgressCtrl
class. The control has been created as an
exercise of converting an existing control written in C# into a new one with the
same features written in C++. The conversion was quite simple. You can find the
original control here. CCylinderProgressControlST
code is more
robust than the original one.
CCylinderProgressControlST
features:
- Easy to use
- Standard
CProgressCtrl
methods
- Support for negative ranges
- Support for vertical progress controls
- Full source code included!
- Cost-less implementation in existing applications
How to integrate CCylinderProgressControlST in your application
In your project include the following files:
- CylinderProgressControlST.h
- CylinderProgressControlST.cpp
With dialog editor create a
progress control called, for example,
IDC_PROGRESS
.
Then
create a member variable for this control:
CCylinderProgressControlST m_prgControl;
Now attach the progress control to CCylinderProgressControlST
.
For dialog-based applications, in your OnInitDialog
:
CDialog::OnInitDialog();
m_prgControl.SubclassDlgItem(IDC_PROGRESS, this);
Or in your DoDataExchange
:
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PROGRESS, m_prgControl);
Your progress control is now a CCylinderProgressControlST
!
Class methods
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(short shLower, short shUpper)
SetRange32
Sets the upper and lower limits of the progress bar control's range and
redraws the bar to reflect the new ranges.
void SetRange32(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()
SetColors
Sets the control's colors.
void SetColors(Color cFullColor, Color cEmptyColor, Color cOutlineColor,
Color cTextColor, Color cBkColor, BOOL bRepaint = TRUE)
SetFullColor
Sets the color of the currently displayed bar.
void SetFullColor(Color cColor, BOOL bRepaint = TRUE)
SetEmptyColor
Sets the color of the control's portion currently left empty.
void SetEmptyColor(Color cColor, BOOL bRepaint = TRUE)
SetOutlineColor
Sets the color used to outline the control.
void SetOutlineColor(Color cColor, BOOL bRepaint = TRUE)
SetTextColor
Sets the color of the displayed text.
void SetTextColor(Color cColor, BOOL bRepaint = TRUE)
SetBkColor
Sets the background color of the control.
void SetBkColor(Color cColor, BOOL bRepaint = TRUE)
SetShowText
Sets if text must be displayed on the control.
void SetShowText(BOOL bShowText, BOOL bRepaint = TRUE)
SetShowOutline
Sets if the control must be outlined.
void SetShowOutline(BOOL bShowOutline, BOOL bRepaint = TRUE)
SetAlpha
Sets the alpha component of the colors used to draw the control.
void SetAlpha(BYTE byAlpha, BOOL bRepaint = TRUE)
GetAlpha
Returns the alpha component of the colors used to draw the control.
BYTE GetAlpha()
SetTooltipText
Sets the text to show in the control tooltip.
void SetTooltipText(int nId, BOOL bActivate = TRUE)
SetTooltipText
Sets the text to show in the control tooltip.
void SetTooltipText(LPCTSTR lpszText, BOOL bActivate = TRUE)
ActivateTooltip
Enables or disables the control tooltip.
void ActivateTooltip(BOOL bActivate = TRUE)
DrawTransparent
Enables the transparent mode. Note: this operation is not reversible.
DrawTransparent
should be called just after the control is created.
Do not use trasparent controls until you really need it (you have a bitmapped
background) since each transparent control makes a copy in memory of its
background. This may bring unnecessary memory use and execution overload.
DWORD DrawTransparent(BOOL bRepaint = FALSE)
OnDrawBackground
This function is called every time the control background needs to be
painted. If the control is in transparent mode this function will
not be called. This is a virtual function that can be rewritten
in CCylinderProgressCtrlST
-derived classes.
virtual DWORD OnDrawBackground(Graphics* pGfx, Rect* rpCtrl)
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 shows the current bar percentage.
virtual DWORD OnDrawText(Graphics* pGfx, int nPercentage, Rect* rpCtrl,
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.0 (27/June/2003)
First release
Disclaimer
THE SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED "AS IS" AND WITHOUT
ANY WARRANTIES WHETHER EXPRESSED OR IMPLIED. NO RESPONSIBILITIES FOR POSSIBLE
DAMAGES OR EVEN FUNCTIONALITY CAN BE TAKEN. THE USER MUST ASSUME THE ENTIRE RISK
OF USING THIS SOFTWARE.