Click here to Skip to main content
Click here to Skip to main content

StatusColorProgressbar

, 9 Mar 2005
Rate this:
Please Sign up or sign in to vote.
An article about adding Alan Zhao's Color Progressbar to your statusbar.

Sample Image

Introduction

This article shows how to easily add Colour Progress bar, by Alan Zhao, to your Windows Form status bar. It's quite simple to do it, of course our friend Alan did a very good job, now we have to use it...

Using the code

See how to create and use Colour Progress bar on Alan Zhao's article.

Now I'm only going to explain how to add a progress bar to your status bar. First, you have to have a Windows Form with a status bar and then create you progress bar. Take a look at the code below:

...
using ColorProgressBar;

namespace WindowsApplication3
{
    /// 
    /// Summary description for Form1.
    /// 
    public class Form1 : System.Windows.Forms.Form
    {
        ...
        private ColorProgressBar.ColorProgressBar progress;
        ...
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor
            // code after InitializeComponent call
            //

            #region Add a Alan Zhao Color ProgressBar
            // progress bar declaration
            this.progress = new ColorProgressBar.ColorProgressBar();
            // lets set progress bar size
            this.progress.Size = new Size(200, 20);
            // lets set progress location
            // to (statusBarPnel1.Width + statusBarPanel2.Width)
            this.progress.Location = new Point(200, 2);

            //Lets set some proprieties of progress bar
            // Bar color
            this.progress.BarColor = Color.AliceBlue;
            this.progress.Maximum = 100;
            this.progress.Minimum = 0;
            this.progress.Step = 1;
            this.progress.BorderColor = Color.Gray;
            this.progress.Value = 0;
            this.progress.FillStyle = 
               ColorProgressBar.ColorProgressBar.FillStyles.Solid;

            // Add progress bar to statusBar
            this.statusBar1.Controls.Add(this.progress);
            // show progress bar
            this.progress.Show();
            #endregion

            // reset counter
            this.button1_Click(this, EventArgs.Empty);

        }

        ...
    }
}

There are four important steps:

  1. Take special attention about the dimensions of your status bar and make your progress bar to fit in the statusbar:
    this.progress.Size = new Size(200, 20);
  2. Once your progress bar fits into your status bar, make it appear on the right place by locating it into your status bar, like this code exemplifies:
    this.progress.Location = new Point(200, 2);
  3. Add it to your status bar:
    this.statusBar1.Controls.Add(this.progress);
  4. Finally show it:
    this.progress.Show();

Isn't it simple?! Sure it is. Now you have just to use your StatusColorProgressbar.

Points of Interest

I was searching for a thing like this to use on my "projecto de bacharelato" - PICrega. I have read many articles on "The Code Project”, but none of them was like what I wanted. Then, I searched and researched and I made one like I wanted. That makes me feel so good, so nice! paparara_ra.

The thing is: you might add other controls to you status bar using: statusbar.Controls.Add(your control).

Thanks

I'd like to thank all "The Code Project" members, and personally Alan Zhao who made a very nice Colour ProgressBar.

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

Share

About the Author

AlexMartins
Engineer Freelancer
Portugal Portugal
No Biography provided

Comments and Discussions

 
Newsthank you Pinmembermatafill++c23-Jun-11 8:54 
GeneralThank you ..... PinmemberJack297-May-08 20:04 

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.

| Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 9 Mar 2005
Article Copyright 2005 by AlexMartins
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid