Click here to Skip to main content
13,352,175 members (73,794 online)
Click here to Skip to main content
Add your own
alternative version


35 bookmarked
Posted 30 Mar 2005

XP like colour progress bar

, 30 Mar 2005
Rate this:
Please Sign up or sign in to vote.
A WinForms progress bar control.

Sample Image


This is a simple progress bar control that imitates the XP visual style. The control inherits Windows.Forms.Control and the reason to add another progress bar here is that there was no XP style progress bar with the ability to change its colour. I needed a red coloured progress bar to indicate error but the normal XP progress bar does not allow colour change. Also, I needed that nice XP style because my program was using the XP visual styles. The bars are drawn just like the XP progress bar. The whole bars are drawn, not parts from them, depending on the value.


For the progress bar, I used the very nice progress bar control developed by Alan Zhao. Basically, the main functionality is provided by him, I improved the painting of the control to make it XP like.

Control Properties

  • BarColor

    The primary color of ColorProgressBar.

  • BorderColor

    The border color of ColorProgressBar.

  • FillStyle

    Bar styles, "Solid" or "Dashed".

  • Maximum

    The maximum value of ColorProgressBar.

  • Minimum

    The minimum value or the initial value of ColorProgressBar.

  • Value

    The current value of ColorProgressBar.

  • Step

    The value of each increment or decrement when you call methods PerformStep() and PerformStepBack().

Control Methods

  • PerformStep()

    Call the PerformStep() method to increase the value set in the Step property.

  • PerformStepBack()

    Call the PerformStepBack() method to decrease the value set in the Step property.

  • Increment(int value)

    Call the Increment() method to increase the integer value you specify.

  • Decrement(int value)

    Call the Decrement() method to decrease the integer value you specify.

Painting code

// The region of the progress bar!
int leftbar = 1;
int topbar = 1;
int X = this.Width-1;
int Y = this.Height-1;
Point[] points = {   new Point(leftbar + 2, topbar), 
         new Point(X-2, topbar), 
         new Point(X-1, topbar + 1), 
         new Point(X, topbar + 2), 
         new Point(X, Y-3), 
         new Point(X-1, Y-2), 
         new Point(X-2, Y-1), 
         new Point(leftbar + 2, Y), 
         new Point(leftbar + 1, Y-2), 
         new Point(leftbar, Y-3), 
         new Point(leftbar, topbar + 2),
         new Point(leftbar + 1, topbar + 1),
GraphicsPath path = new GraphicsPath();
Region reg = new Region(path);
e.Graphics.FillRegion(Brushes.White, reg);

This is the definition of the region of the progress bar.

Points of Interest

The project is interesting if you want to learn how to simulate and to draw controls like they are drawn in Windows XP.


No history yet.


Thanks again to Alan Zhao for his great work. You can check out his work here.


Please vote for this article.

And email me or leave your messages if you have:

  • bug reports
  • code improvements
  • any comments or suggestions.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Ivan Mihaylov
Bulgaria Bulgaria
Software engineer for TeamR3 Bulgaria.

You may also be interested in...


Comments and Discussions

GeneralNice Pin
abno2-Oct-07 6:23
memberabno2-Oct-07 6:23 
QuestionHow to use the code Pin
craude1-Jan-07 1:07
membercraude1-Jan-07 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 30 Mar 2005
Article Copyright 2005 by Ivan Mihaylov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid