Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / Visual Basic

Fully Customizable XP Progress Bar (with examples)

Rate me:
Please Sign up or sign in to vote.
4.80/5 (120 votes)
20 Jan 2015CPOL2 min read 406.1K   13.8K   257   81
A progress bar like the WinXP progress bar control, but completely customizable.

Image 1

Introduction

I've developed an XpProgressBar that looks like the one used by the default WinXP theme. I have added a lot of features to fully customize its look.

Very important !!!

If you update the position of the progress bar in a tight loop or in a CPU intensive area and you feel that the bar is not repainted, use the following code in the place where you have problem:

C#
Application.DoEvents();

Please don't use Invalidate(), .Refresh() or .Update(). This can result in low performance and sometimes these don't work.

XpProgressBar features

The control offers the following features:

  • Good performance

    The XpProgressBar doesn't use much of the CPU because it uses a double buffer feature that performs painting operations offline to an image and later to the screen (this works at least three times faster).

  • Non flicking double buffer

    This control is implemented with a double buffer to provide smooth animation without any flicking and small paint time.

  • Anti alias text

    All the strings painted in the progress bar are drawn using anti alias hint to provide better quality.

  • Text shadow

    You can set the shadow to the text and customize its color and the alpha channel.

  • Fully customizable

    As you can see, every property of the progress bar can be set to provide a beautiful look.

Image 2

The properties of the control:

  • BackgroundImage
  • ColorBackground
  • ColorBarBorder
  • ColorBarCenter
  • ColorsXp

    Reset the colors to WinXP default.

  • ColorText
  • GradientStyle
  • SteepDistance
  • SteepWidth
  • TextShadow
  • TextShadowAlpha

GradientStyle

You can set the GradientStyle property to obtain some of these styles:

Image 3

Animation sample

The following picture shows an animation sample with different timers and looks:

Image 4

License

The control and the source code are completely free for commercial and non commercial use.

History

  • 2005-10-1: Article submitted.
    • 1.5
      • Improved the performance of Paint algorithms.
      • Alpha text
      • The image on the ProgressBar looks like a logo (with alpha of course, jeje).
      • Can disable Anti Alias Text.
    • 2.0
      • Vertical ProgressBar (not only horizontal)
      • Text align
      • Border color

Updates

Visit my page Marcos Meli and come back with updates soon.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Devoo
Argentina Argentina
Marcos Meli v1.0 was released at august of 1980 by Francisco and Mabel Inc.
He´s from Bahia Blanca, Argentina.

He enjoy developing from the 12 years, has a degree in Computer Science, and of course, love this site and .NET in general.

He is the lead developer of the FileHelpers Library.

Marcos is also the co-funder of Devoo.Net.
A company that provides Object Oriented Components & Libraries for .NET developers (mostly open source)

Comments and Discussions

 
GeneralSimply Brilliant Pin
KiaT25-Nov-06 17:00
KiaT25-Nov-06 17:00 
GeneralRe: Simply Brilliant Pin
Marcos Meli8-Nov-06 2:12
Marcos Meli8-Nov-06 2:12 
GeneralNice Work [modified] Pin
seq-22-Jul-06 9:14
seq-22-Jul-06 9:14 
GeneralRe: Nice Work Pin
Marcos Meli22-Jul-06 9:26
Marcos Meli22-Jul-06 9:26 
GeneralRe: Nice Work Pin
nkxiawu3-Oct-06 16:41
nkxiawu3-Oct-06 16:41 
QuestionHow to auto change the text color? Pin
yazoox27-Mar-06 18:27
yazoox27-Mar-06 18:27 
AnswerRe: How to auto change the text color? Pin
Marcos Meli28-Mar-06 2:57
Marcos Meli28-Mar-06 2:57 
GeneralFantastic! Pin
verosystems24-Mar-06 6:55
verosystems24-Mar-06 6:55 
This is by far the best progress bar I have seen. I plan on using it an RSS Aggregator I've written.

Thanks again.
GeneralRe: Fantastic! Pin
Marcos Meli24-Mar-06 10:45
Marcos Meli24-Mar-06 10:45 
QuestionChanging the Start Position Pin
Jonathan Merriweather28-Feb-06 2:43
Jonathan Merriweather28-Feb-06 2:43 
AnswerRe: Changing the Start Position Pin
Marcos Meli24-Mar-06 10:42
Marcos Meli24-Mar-06 10:42 
GeneralRe: Changing the Start Position Pin
Jonathan Merriweather24-Mar-06 18:56
Jonathan Merriweather24-Mar-06 18:56 
QuestionUsing as a trackBar? Pin
theTron6-Feb-06 7:21
theTron6-Feb-06 7:21 
AnswerRe: Using as a trackBar? Pin
theTron6-Feb-06 8:30
theTron6-Feb-06 8:30 
GeneralPerfect! Pin
sparky90913-Jan-06 6:28
sparky90913-Jan-06 6:28 
GeneralRe: Perfect! Pin
Greg the Grip24-Jan-06 18:43
Greg the Grip24-Jan-06 18:43 
AnswerRe: Perfect! Pin
Marcos Meli25-Jan-06 7:04
Marcos Meli25-Jan-06 7:04 
GeneralRe: Perfect! Pin
Greg the Grip25-Jan-06 13:58
Greg the Grip25-Jan-06 13:58 
GeneralThanks ! Pin
dapoussin23-Dec-05 5:13
dapoussin23-Dec-05 5:13 
GeneralRe: Thanks to you Pin
Marcos Meli25-Jan-06 7:05
Marcos Meli25-Jan-06 7:05 
QuestionVertical? Pin
John Boero6-Dec-05 5:20
John Boero6-Dec-05 5:20 
AnswerRe: Vertical? Pin
Marcos Meli6-Dec-05 9:35
Marcos Meli6-Dec-05 9:35 
AnswerRe: Vertical? Pin
DesaBoy11-Jan-06 1:24
DesaBoy11-Jan-06 1:24 
GeneralApplication.DoEvents is not the answer! Pin
ekriel28-Nov-05 6:05
ekriel28-Nov-05 6:05 
AnswerBut Application.DoEvents is the answer for many people Pin
Marcos Meli28-Nov-05 11:44
Marcos Meli28-Nov-05 11:44 

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.