Click here to Skip to main content
Licence 
First Posted 8 Feb 2005
Views 90,443
Downloads 477
Bookmarked 38 times

Advanced Progressbar

By Gil.Schmidt | 24 Jan 2006
An extended progress bar with support for shape based progress bars and 3D colors.
4 votes, 19.0%
1
3 votes, 14.3%
2
5 votes, 23.8%
3
2 votes, 9.5%
4
7 votes, 33.3%
5
2.98/5 - 21 votes
μ 2.98, σa 2.71 [?]

Advanced Progressbar sample

Advanced Progressbar sample

Introduction

This article explains an extended progress bar with support for shape based progress bars and 3D colors.

Background

The first version only included a basic rectangle progress bar with "3D" abilities and percent display. I decided to add a dynamic shape function so it could be used with any shape (you can add more shapes in the CreateRegion function).

Using the code

Just place it on the form and have a look at the properties:

  • FillingMethod - the direction of the gradient (right to left, left to right..).
  • GradientMethod - the way the gradient is drawn (Horizontal, Vertical, 3D).
  • Shape - the shape of the progress bar (rectangle, ellipse, rounded rectangle, triangle, magen david, snake).

Other stuff you should have a look at are: BorderSize, BorderDisplay, and PercentDisplay.

Points of Interest

Good progress bars are easy to find today, but I wrote this one because I didn't find one that I liked that supported percents display, and the rest is history.

History

The first version only included a simple rectangle progress bar and was written very specifically for rectangle. Later, I wanted to add one more style, and I decided to write it dynamically for any shape. This is an updated version fixed for .NET 2.0.

License

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

Gil.Schmidt

Software Developer
EZFace
Israel Israel

Member
Infrastructure engineer.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralProgressbar shape trapezium PinmemberNRG560:25 9 Apr '07  
GeneralRe: Progressbar shape trapezium PinmemberGil.Schmidt12:45 10 Apr '07  
GeneralProblem with Whidbey: percent text is not centralized Pinmemberhungpvtn0:47 15 Jan '06  
The control was working well when I was using VS2003 and .NET 1.1. I have just switched to VS2005/.Net 2.0 and the percent text is not centralized.
I have tried to make to modifications to fix it. Here is the code:
 
private void DrawPercent(Graphics G)
{
// very ugly way to do it, but it works well
Label PercentLabel = new Label();
PercentLabel.AutoSize = true;
PercentLabel.Font = this.Font;
PercentLabel.Text = _Position.ToString() + "%";
 
SizeF TextSize = G.MeasureString(PercentLabel.Text, this.Font);
 
float left = this.ClientRectangle.X + (this.ClientRectangle.Width - TextSize.Width) / 2;
float top = this.ClientRectangle.Y + (this.ClientRectangle.Height - TextSize.Height) / 2;
 
SolidBrush mTextBrush = new SolidBrush(this.ForeColor);
G.DrawString(PercentLabel.Text, this.Font, mTextBrush, left, top);
mTextBrush.Dispose();
 
}
GeneralRe: Problem with Whidbey: percent text is not centralized PinmemberGil_Schmidt1:11 15 Jan '06  
GeneralUse in VB .NET Pinmemberkenexcelon18:15 27 Aug '05  
GeneralRe: Use in VB .NET Pinmemberkenexcelon18:16 27 Aug '05  
GeneralRe: Use in VB .NET PinmemberGil_Schmidt1:50 28 Aug '05  
GeneralRe: Use in VB .NET Pinmemberkenexcelon6:18 28 Aug '05  
GeneralRe: Use in VB .NET PinmemberGil_Schmidt11:22 28 Aug '05  
GeneralRe: Use in VB .NET Pinmemberkenexcelon11:49 28 Aug '05  
GeneralRe: Use in VB .NET Pinmemberkenexcelon19:06 29 Aug '05  
GeneralRe: Use in VB .NET PinmemberGil_Schmidt22:46 29 Aug '05  
GeneralRe: Use in VB .NET Pinmemberkenexcelon11:48 30 Aug '05  
GeneralRe: Use in VB .NET PinmemberGil_Schmidt12:36 30 Aug '05  
Questionhow to use in VB.NET??? Pinmemberaminir21:21 25 Aug '05  
AnswerRe: how to use in VB.NET??? PinmemberGil_Schmidt23:16 25 Aug '05  
GeneralRe: how to use in VB.NET??? Pinmemberaminir3:52 26 Aug '05  
GeneralRe: how to use in VB.NET??? PinmemberGil_Schmidt6:58 26 Aug '05  
GeneralRe: how to use in VB.NET??? PinmemberThe_Mega_ZZTer11:48 24 Jan '06  
Generalcannot download the source code PinmemberBnaya Eshet22:48 20 Jul '05  
QuestionWould you take a look? PinmembereRRaTuM5:25 30 May '05  
GeneralSmoothing Mode Pinmemberromias1:50 9 Feb '05  
GeneralRe: Smoothing Mode PinmemberGil_Schmidt3:37 9 Feb '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.5.120210.1 | Last Updated 24 Jan 2006
Article Copyright 2005 by Gil.Schmidt
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid