Click here to Skip to main content
15,171,993 members
Articles / Desktop Programming / Windows Forms
Posted 30 May 2008


121 bookmarked

Custom ProgressBar Control

Rate me:
Please Sign up or sign in to vote.
4.75/5 (38 votes)
8 Jun 2011CPOL3 min read
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#...

Comments and Discussions

QuestionAdding more Functions to the control Pin
Member 1304087330-Jun-18 0:47
MemberMember 1304087330-Jun-18 0:47 
AnswerRe: Adding more Functions to the control Pin
SSDiver211215-Jul-18 14:23
MemberSSDiver211215-Jul-18 14:23 
Questiondownloading Pin
Artem Alexashin20-Mar-16 10:17
MemberArtem Alexashin20-Mar-16 10:17 
QuestionCan i put my progress bar in another project? Pin
Enzotech26-Nov-15 16:36
MemberEnzotech26-Nov-15 16:36 
AnswerRe: Can i put my progress bar in another project? Pin
SSDiver21127-Nov-15 6:45
MemberSSDiver21127-Nov-15 6:45 
QuestionRe: Can i put my progress bar in another project? Pin
Enzotech27-Nov-15 7:53
MemberEnzotech27-Nov-15 7:53 
AnswerRe: Can i put my progress bar in another project? Pin
SSDiver21128-Nov-15 14:16
MemberSSDiver21128-Nov-15 14:16 
GeneralRe: Can i put my progress bar in another project? Pin
Enzotech28-Nov-15 21:22
MemberEnzotech28-Nov-15 21:22 
QuestionCan I put my progress bar on another form? Pin
Enzotech219-Oct-15 18:37
MemberEnzotech219-Oct-15 18:37 
AnswerRe: Can I put my progress bar on another form? Pin
SSDiver21127-Nov-15 6:44
MemberSSDiver21127-Nov-15 6:44 
Questionhi. Pin
Allan Patrick Caldito8-Sep-15 7:13
MemberAllan Patrick Caldito8-Sep-15 7:13 
AnswerRe: hi. Pin
SSDiver21129-Sep-15 5:26
MemberSSDiver21129-Sep-15 5:26 
QuestionVS2012 Pin
Member 21604624-Jun-15 12:02
MemberMember 21604624-Jun-15 12:02 
AnswerRe: VS2012 Pin
SSDiver21129-Jun-15 4:08
MemberSSDiver21129-Jun-15 4:08 
QuestionHow do I change the step size Pin
Member 106486346-Mar-14 5:58
MemberMember 106486346-Mar-14 5:58 
AnswerRe: How do I change the step size Pin
Member 106486346-Mar-14 5:59
MemberMember 106486346-Mar-14 5:59 
QuestionAbility to Center Form? Pin
M.Sanders9-Dec-13 9:35
MemberM.Sanders9-Dec-13 9:35 
QuestionHow to put in visual basic Pin
Member 992891720-Mar-13 17:25
MemberMember 992891720-Mar-13 17:25 
AnswerRe: How to put in visual basic Pin
Jeff Reith6-Apr-13 13:20
MemberJeff Reith6-Apr-13 13:20 
GeneralRe: How to put in visual basic Pin
SSDiver21126-Apr-13 14:07
MemberSSDiver21126-Apr-13 14:07 
AnswerRe: How to put in visual basic Pin
SSDiver21126-Apr-13 14:08
MemberSSDiver21126-Apr-13 14:08 
QuestionRe: How to put in visual basic Pin
Enzotech219-Oct-15 18:48
MemberEnzotech219-Oct-15 18:48 
QuestionRe: How to put in visual basic Pin
Enzotech219-Oct-15 18:50
MemberEnzotech219-Oct-15 18:50 
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 

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.