主题:timer 和 progressbar
[em18]
做一个进度条,让他一秒一跳,10秒跳完,可是我写了代码编译没有问题,他就是不跳呢,高手门指教下哈,好吧,我承认这是基础问题,我也是个新手。
我的代码如下:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Timer t = new Timer();
this.progressBar1.Value = 0;
t.Start();
t.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
this.progressBar1.Minimum = 0;
this.progressBar1.Maximum = 100;
if (this.progressBar1.Value <= this.progressBar1.Maximum)
this.progressBar1.Value ++;
}
做一个进度条,让他一秒一跳,10秒跳完,可是我写了代码编译没有问题,他就是不跳呢,高手门指教下哈,好吧,我承认这是基础问题,我也是个新手。
我的代码如下:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Timer t = new Timer();
this.progressBar1.Value = 0;
t.Start();
t.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
this.progressBar1.Minimum = 0;
this.progressBar1.Maximum = 100;
if (this.progressBar1.Value <= this.progressBar1.Maximum)
this.progressBar1.Value ++;
}