下面是一个进展条的代码:
public void UpdatePercentText()
{
int nPercent,nRange;
nRange=progressBar1.Maximum-progressBar1.Minimum;
nPercent=100*progressBar1.Value / nRange;
label1.Text=String.Concat(nPercent.ToString(),"%" );
}
private void Form1_Load(object sender, System.EventArgs e)
{
progressBar1.Maximum=100;
progressBar1.Minimum=0;
progressBar1.Value=0;
progressBar1.Step=1;
UpdatePercentText();
}
private void button1_Click(object sender, System.EventArgs e)
{
int nStep=-progressBar1.Step;
progressBar1.Increment(nStep);
UpdatePercentText();
}
private void button2_Click(object sender, System.EventArgs e)
{
progressBar1.PerformStep();
UpdatePercentText();
}
这是一个手动的,点击进展一个步长,我现在想让它能自动进展的,并进展到100%时弹出下载完毕对话框,这样能实现吗?又在那里怎样改呢??请各位高手多多指点!