Enhanced ProgressBar Control v1.1


In this article I want to introduce enhanced ProgressBar control. I collect some ideas from article on CodeGuru and CodeProject, add some my own ideas and develop this control. I try to develop it in most common, flexible and extensible way. You can also use any standard functionality of ProgressBar and MFC wrapper CProgressCtrl. In order to see more of my work, drop by and visit my home page.


  • Filling with gradient colors
  • Multi-color gradient
  • Rubber gradient
  • Filling with brush for background and progress indicator (overrides color settings)
  • Text on bar
  • Dual color for text
  • Vertical text support (0-90-180-270 degree rotated text)
  • Font settings support
  • Formatted text (can show percent, position or plain text)
  • Text tied to progress indicator
  • Support for vertical oriented control
  • Reverse mode
  • Snake mode
  • Borders

Advanced Interface:

Text Styles (to set text format use "SetTextFormat" and "HideText"):

#define PBS_SHOW_PERCENT         0x0100
#define PBS_SHOW_POSITION        0x0200
#define PBS_SHOW_TEXTONLY        0x0300

Control Styles (use "ModifyStyle" or appropriated functions):

#define PBS_TIED_TEXT            0x1000
#define PBS_RUBBER_BAR           0x2000
#define PBS_REVERSE              0x4000
#define PBS_SNAKE                0x8000

Advanced functionality:

void SetGradientColors(COLORREF clrStart, 
                       COLORREF clrEnd);
void GetGradientColors(COLORREF& clrStart, 
                       COLORREF& clrEnd);

void SetGradientColorsX(int nCount, 
                        COLORREF clrFirst, 
                        COLORREF clrNext, ...);
const CDWordArray& GetGradientColorsX();

void SetBarBrush(CBrush* pbrBar);
CBrush* GetBarBrush();

void SetBkColor(COLORREF clrBk);
COLORREF GetBkColor();

void SetBkBrush(CBrush* pbrBk);
CBrush* GetBkBrush();

void SetTextColor(COLORREF clrTextOnBar, 
                  COLORREF clrTextOnBk = -1);
COLORREF GetTextColor();
COLORREF GetTextColorOnBk();

void SetShowPercent(BOOL fShowPercent = TRUE);
BOOL GetShowPercent();

void SetTextFormat(LPCTSTR szFormat, 
                   DWORD ffFormat = PBS_SHOW_TEXTONLY);
void HideText();

void SetTiedText(BOOL fTiedText = TRUE);
BOOL GetTiedText();

void SetRubberBar(BOOL fRubberBar = TRUE);
BOOL GetRubberBar();

void SetReverse(BOOL fReverse = TRUE);
BOOL GetReverse();

void SetSnake(BOOL fSnake = TRUE);
BOOL GetSnake();

void SetSnakeTail(int nTailSize);
int  GetSnakeTail();

void SetBorders(const CRect& rcBorders);
const CRect& GetBorders();

You can use also:

  • SetFont() - to set font and rotation(Escapement) of the text
  • SetWindowText() - to set text on control (better use SetTextFormat())
  • SetStyle(),ModifyStyle() - to change styles of control
  • SendMessage() - to send any ProgressBar or window messages
  • Any functionality of base class CProgressCtrl

See Test Project for additional information of usage.


The best view and performance you can get on HighColor(15/16 bit) and TrueColor(24/32 bit) resolutions. Control also supports 256 and 16 color modes. But in 16 colors mode you cannot use gradient, and in 256 colors mode control works slower because of usage CreateSolidBrush/FillRect instead of FillSolidRect.

Control is part of UIBits.dll and independent usage requires two additional files: DrawGdiX.h and MemDC.h.


Download demo project - 57 Kb
Download source - 12 Kb

August 2, 2000 - version 1.1
June 5, 2000 - version 1.0

Write me about any problem or ideas.



  • Excellent

    Posted by ovidiucucu on 03/30/2005 01:55am

    Good job. You've got my five stars.

  • paparia

    Posted by BillGates2 on 03/04/2005 01:24pm

    It reminds me of DOS. Is this your best try for 10 lines of code....? gosh. I hope other people do not waste their time on your disatisfying piece of ..code. How did you come up with the idea you could name it advanced?

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 23, 2015 The cloud is not just about a runtime platform for your projects – now, you can do your development in the cloud, too. Check out this webcast to learn how the cloud improves your development experience and team collaboration. Join Dana Singleterry, Principal Product Manager for Oracle Dev Tools, as he discusses how to simplify every aspect of the development lifecycle, including requirements gathering, version management, code reviews, build automation, and …

  • Moving from an on-premises environment to Office 365 does not remove the need to plan for disruptions or reduce the business risk requirements for protecting email services. If anything, some risks increase with a move to the cloud. Read how to ease the transition every business faces if considering or already migrating to cloud email. This white paper discusses: Setting expectations when migrating to Office 365 Understanding the implications of relying solely on Exchange Online security Necessary archiving …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date