ProgressBar
<1>基本信息设置
progressBar1.Maximum = 1000; //设置ProgressBar的最大值
progressBar1.Value = 0; //ProgressBar的初始值
progressBar1.Step = 5; //ProgressBar的增长度
for (int i = 0; i < 10; i++)
{
System.Threading.Thread.Sleep(1000);
progressBar1.Value += progressBar1.Step;
}
<2>C#中ProgressBar进度条从右向左显示:
progressBar1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
progressBar1.RightToLeftLayout = true;
<3>C#中动态添加垂直显示的进度条
首先声明代表进度条的全局对象: ProgressBar ProgressBar1 = new ProgressBar(); //进度条对象
ProgressBar1 = AddNewProgressBar(182, 95,"RightProgressbar"); //(182,95)为Location
private ProgressBar AddNewProgressBar(int x, int y,string name) //动态添加垂直进度条方法
{
ProgressBar progressbar = new VerticlaProgressBar();
progressbar.Location = new System.Drawing.Point(x, y);
progressbar.Name = name;
progressbar.Size = new System.Drawing.Size(23, 300);
progressbar.Minimum = 0;
progressbar.Maximum = 300;
progressbar.TabIndex = 0;
this.panel9.Controls.Add(progressbar);
return progressbar;
}