C# winform 程序进度条
程序员文章站
2022-06-27 21:02:58
控制条控件: progressBar 不能按照你程序的进程自动变化,需认为计算,调整变化量 private void progressBar1_Click(object sender, EventArgs e) { this.progressBar1.Maximum = 100;//设置进度条最大长 ......
控制条控件: progressbar
不能按照你程序的进程自动变化,需认为计算,调整变化量
private void progressbar1_click(object sender, eventargs e)
{
this.progressbar1.maximum = 100;//设置进度条最大长度值
this.progressbar1.value = 0;//设置当前值
}
progressbar1.invoke(new action(() => { this.progressbar1.value = 0; })); //进度条初始化
if (this.progressbar1.value < 45)
{
progressbar1.invoke(new action(() => { this.progressbar1.value += 5; }));//改变进度条的值
}
progressbar1.invoke(new action(() => { this.progressbar1.value = this.progressbar1.maximum; })); //进度条到达满值