I have installed many software in my computer. When installing any software, I saw ProgressBar in Installation Window. I always thought, why most of the installation packages come with a ProgressBar?
The answer was simple. Because progress bar has no boundary of language. Any human can see and watch the progress of a process visually. There is no need of any words. This is one of the reasons, a ProgressBar is widely used in many application that needs to show the progress and process completion status.
In this blog and code below, I show how to use and customize a ProgressBar control.
Basic declaration and properties of Status ProgressBar are following:
// Change the type of the panel to StatusBarProgressPanel on your Form
private StatusBarProgressPanel progressPanel;
// Initialize the measurement values
progressPanel.StartPoint = 0;
progressPanel.EndPoint = 100;
progressPanel.StepSize = 1;
progressPanel.ProgressPosition = 0;
// Sample usage:
// progress the bar by one "step"
progressPanel.Step();
// reset the progress bar to the initial state
progressPanel.Reset();
// start/stop an infinite animation thread for the bar
// this is useful when you don't know how long something
// is going to take, or if the progress is just unmeasurable
progressPanel.StartAnimation();
progressPanel.StopAnimation();
// By default the value of the percentage of progress is displayed
// setting the "ShowText" property to false disables it
progressPanel.ShowText = false;
We can also change these properties visually from the designer.
You may also change the AnimationStyle
of the control. This basically controls the way the indicator is filled and emptied. The default is ProgressDisplayStyle.Infinate
which is a pulsating draw style. Much cooler graphics can be used, just modify the Parent_DrawItem
method.
///
/// Statusbar Progress Display Styles
///
public enum ProgressDisplayStyle
{
///
/// A continually moving animation
///
Infinite,
///
/// A progress bar that fills from left to right
///
LeftToRight,
///
/// A progress bar that fills from right to left
///
RightToLeft,
///
/// A progress bar that fills from bottom to top
///
BottomToTop,
///
/// A progress bar that fills from top to bottom
///
TopToBottom
}
---------------------------------------------------------------------------------
Download the attachment and Starts Using Progress Bar in your Application.