Click here to Skip to main content
13,351,457 members (45,888 online)
Click here to Skip to main content
Add your own
alternative version


115 bookmarked
Posted 30 May 2008

Custom ProgressBar Control

, 8 Jun 2011
Rate this:
Please Sign up or sign in to vote.
Easy to use ProgressBar Control with many properties


Why another Progress Bar? The Standard ProgressBar was too limited and I couldn't find a custom control written that did all that I wanted. This is a UserControl with lots of properties and versatility. It shows minimum to maximum value progress or infinite back and forth progress. It is simple to use, just drop it on the form, adjust the design time properties and use it like the normal ProgressBar.


This was my first UserControl that implemented some design time properties including an expandable property with the ExpandableObjectConverter TypeConverter and ControlDesigner. I have expanded the Design-Time editing in Version 2.0 using the techniques explained here: UITypeEditorsDemo[^] (Because of the new Editors, a revamp of the Properties occurred so there are some differences from the previous version). The demo also illustrates how to use a component or runtime BackgroundWorker to run different threads.

Control Properties

Here is a list of the primary properties:

  • BarStyleFill

    The fill style for the bar. Solid, Patterns, multiple color blends, and Image

  • BarColorBlend

    The Colors and Positions used for Gradient fills

  • BarColorSolid, BarColorSolidB

    The Colors used for Solid and Hatch fills

  • FocalPoints

    The movable Centerpoint and Focus Scales for the color blends

  • Shape

    The shape of the bar. Rectangle, Ellipse, Triangle, and Text

  • BorderColor, BorderWidth

    Change the border properties

  • Orientation

    Horizontal or Vertical progress

  • FillDirection

    Horizontal Right to Left or Left to Right and Vertical Bottom to Top or Top to Bottom

  • Corners, CornersApply

    Adjust the corner radius and apply to the border, bar, or both

  • ForeColor, TextAlignment, TextAlignmentVert, TextWrap, TextPlacement, Shadow

    Adjust the color, alignments, wrapping, and if the text appears over the control or moves with the bar

  • TextShow, TextFormat

    Templates for what text to display:

    • None
    • Value = Just the Value
    • ValueOfMax = Formats the Value with the Max i.e. '22 of 100'
    • Percent = Just the ValuePercent with a percent sign
    • FormatString = Enter any text here:
      • Enter {0} where you want the Value to show.
      • Enter {1} where you want the ValuePercent to show.
      • Enter {2} where you want the Max to show.
        i.e. '{0} rows of data out of {2} processed'
  • BarType

    Display Min to Max progress or Back and Forth infinite progress

  • BarLength, BarLengthValue

    Bar continues to expand with the Value or a fixed length of the bar moves with the value

  • Min, Max

    The minimum and maximum value of the ProgressBar

  • Value

    The current value of the ProgressBar

  • ShowDesignBorder

    Show a dotted line in design mode only if there is no border

Control Methods

  • ValuePercent()

    Get the Percent the value represents

  • ResetBar(opt value)

    Sets the Value to MinValue or MaxValue

  • Increment(opt value)

    Increase the value by one or the value given

  • Decrement(opt value)

    Decrease the value by one or the value given

Using the Code

Once you get the Progress Bar looking the way you want, add some code. You can directly change the Value property or use the Increment/Decrement methods:

With MyProgBarText
   .Max = 200
   For i As Int32 = 0 To 200
       // Add Your Code Here
End With

For the Infinite Progress Bar, change the BarType and change the CylonRun Boolean value:

MyProgBarCylon.BarType = MyProgBar.eBarType.CylonBar
MyProgBar.CylonRun = True

Points of Interest

The SmartTag makes it easy to customize the Progress Bar. All the important properties are organized to simplify the process.



  • Version 1.0 February 2008
  • Version 2.0 November 2008
  • Version 3.0 June 2011
    • Many design and layout fixes


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


About the Author

Software Developer
United States United States
I first got hooked on programing with the TI994A. After it finally lost all support I reluctantly moved to the Apple IIe. Thank You BeagleBros for getting me through. I wrote programs for my Scuba buisness during this time. Currently I am a Database manager and software developer. I started with VBA and VB6 and now having fun with VB.NET/WPF/C#...

You may also be interested in...


Comments and Discussions

QuestionPlease i need help Pin
Samjoke6-Feb-13 18:47
memberSamjoke6-Feb-13 18:47 
AnswerRe: Please i need help Pin
SSDiver21126-Feb-13 18:57
memberSSDiver21126-Feb-13 18:57 
GeneralRe: Please i need help Pin
Samjoke7-Feb-13 5:48
memberSamjoke7-Feb-13 5:48 
GeneralMy vote of 5 Pin
Polinia11-Jan-13 8:07
memberPolinia11-Jan-13 8:07 
Bugi have this errors in the designer mode in visual studio 2012 Pin
spiritdead23-Aug-12 17:06
memberspiritdead23-Aug-12 17:06 
GeneralRe: i have this errors in the designer mode in visual studio 2012 Pin
spiritdead26-Aug-12 10:31
memberspiritdead26-Aug-12 10:31 
QuestionThanks Pin
Jose David Campo10-Jul-12 8:26
memberJose David Campo10-Jul-12 8:26 
QuestionNice Control! Pin
soupman614-Jan-12 9:12
membersoupman614-Jan-12 9:12 
I long for the days when I could just click-on my TI-994A, see the prompt "TI-Basic Ready", and start having fun. (Remember Parsec?)

This control is very sweet.

I'm wondering what it would take to get it to compile using the .Net 4.0 Client Profile?


AnswerRe: Nice Control! Pin
SSDiver21124-Jan-12 14:04
memberSSDiver21124-Jan-12 14:04 
GeneralRe: Nice Control! Pin
soupman615-Jan-12 9:03
membersoupman615-Jan-12 9:03 
QuestionHow do I compile Pin
treaverh24-Nov-11 18:42
membertreaverh24-Nov-11 18:42 
AnswerRe: How do I compile Pin
SSDiver211226-Nov-11 18:04
memberSSDiver211226-Nov-11 18:04 
GeneralImpressive Pin
CIDev8-Jun-11 6:49
memberCIDev8-Jun-11 6:49 
GeneralCan't find the .dll Pin
mikehilton11-Nov-09 8:31
membermikehilton11-Nov-09 8:31 
GeneralRe: Can't find the .dll Pin
mikehilton11-Nov-09 9:12
membermikehilton11-Nov-09 9:12 
GeneralRe: Can't find the .dll [modified] Pin
Onur Guzel27-Apr-11 1:04
memberOnur Guzel27-Apr-11 1:04 
GeneralRe: Can't find the .dll Pin
SSDiver211227-Apr-11 3:02
memberSSDiver211227-Apr-11 3:02 
GeneralInstalling the control in VB Pin
dedawson402420-Apr-09 10:30
memberdedawson402420-Apr-09 10:30 
GeneralRe: Installing the control in VB Pin
SSDiver211220-Apr-09 11:15
memberSSDiver211220-Apr-09 11:15 
GeneralRe: Installing the control in VB Pin
dedawson402420-Apr-09 11:53
memberdedawson402420-Apr-09 11:53 
GeneralGood control Pin
Donsw8-Feb-09 7:14
memberDonsw8-Feb-09 7:14 
Generalso good Pin
taziscool2-Jan-09 21:01
membertaziscool2-Jan-09 21:01 
GeneralAwesome Pin
Member 448805530-Nov-08 19:43
memberMember 448805530-Nov-08 19:43 
GeneralC# version Pin
Member 373886028-Nov-08 4:23
memberMember 373886028-Nov-08 4:23 
GeneralRe: C# version Pin
SSDiver211228-Nov-08 4:33
memberSSDiver211228-Nov-08 4:33 

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 8 Jun 2011
Article Copyright 2008 by SSDiver2112
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid