控制條控制項: 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; })); //進度條到達滿值