Progress Bar:
In this
article I am going to explain how to create and use Progress
Bar Control
A Progress
Bar control is used to represent the progress of a lengthy operation that takes time where a user has to wait for the
operation to be finished.
Properties:
The Following are the important properties of Progress Bar. Those are
1. Minimum. This property obtains or sets
the lower value for the range of valid values for progress. The default value of this
property is zero (0); you cannot set this property to a negative value
2. Maximum. This property obtains or sets
the upper value for the range of valid values for progress. The default value
of this property is 100.
3. Value. This property obtains or sets
the current level of progress. The value must be in the range that the Minimum and the Maximum properties define.
4. ProgressBarColor. This property obtains or sets the color of the progress bar.
5. RightToLeftLayout
Progress
Bar control can also show the progress from right to left by setting
RightToLeftLayout to true(default is left to right)
6. MarqueeAnimationSpeed property represents the time period, in milliseconds, that
it takes the progress block to scroll across the progress bar.
Creating a Progress Bar:
We can create the Progress Bar in two ways
1)
At Design Time.
2)
At Run Time.
At
Design Time:
To create the Progress bar at design time, select
Progress Bar from the tool box and drag it into form. Then it looks like below.
At Run Time:
To Create
the Progress Bar at run time, use Progress Bar Class. Create an instance to this class, set it
properties and add it to the form.
First
create a instance to the class
ProgressBar PBar1 = new ProgressBar();
Then set it required properties. The following code
demonstrate how to set the value of its properties.
PBar1.Location = new
System.Drawing.Point(20, 20);
PBar1.Width = 300;
PBar1.Height = 50;
PBar1.Maximum = 1000;
But in desing time we can
set the properties of Progress Bar by opening the properties window using F4 or
right click on control, go to properties
Adding to Form
Controls.Add(PBar1);
No comments:
Post a Comment