V
visli
Unregistered / Unconfirmed
GUEST, unregistred user!
一个简单的问题,好奇怪:
我想用Timer控件来控制进度条控件Progressbar, Timer每执行一次(1秒一次),进度条就前进一格,Timer执行10秒后,进度条走满.
但运行时Progressbar竟然没反应,根本不走.
控件设计时属性:
Timer1.Enabled := False;
Timer1.Interval := 1000;
ProgressBar1.Max := 10000;
ProgressBar1.Min := 0;
ProgressBar1.Step := 1;
ProgressBar1.Position := 0;
代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled := true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
progressbar1.StepIt;
if progressbar1.Position = progressbar1.Max then timer1.Enabled := false;
end;
我想用Timer控件来控制进度条控件Progressbar, Timer每执行一次(1秒一次),进度条就前进一格,Timer执行10秒后,进度条走满.
但运行时Progressbar竟然没反应,根本不走.
控件设计时属性:
Timer1.Enabled := False;
Timer1.Interval := 1000;
ProgressBar1.Max := 10000;
ProgressBar1.Min := 0;
ProgressBar1.Step := 1;
ProgressBar1.Position := 0;
代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled := true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
progressbar1.StepIt;
if progressbar1.Position = progressbar1.Max then timer1.Enabled := false;
end;