procedure TForm1.FormCreate(Sender: TObject); begin T := 20.000; Timer1.Interval := 1; Timer1.Enabled := True; end; procedure TForm1.Timer1Timer(Sender: TObject); var T:single; begin T := T - 0.001; if T = 0.000 then Timer1.Enabled := false; end大概是这样吧……
这个计时……是倒数20分钟吗?这样的话就应该是设置60秒一个周期…… T := 60.000; Min := 20;//整形 在Timer1Timer事件中 是 T := T - 0.001; if T := 0.000 then begin T := 60.000; Min := Min - 1; en;; 还有如果按楼上sololie所说,不无道理,实际上要那么大的精度也没用
毫秒是1000帧,微妙就1000000帧了!! 其实我想做的是百分之一秒。。 汗,那就是10ms,要这么复杂干啥![qoute=引用 msdn:] 操作系统提供了几个精度不同的计时器: Function Units Resolution --------------------------------------------------------------------------- Now, Time, Timer seconds 1 second GetTickCount milliseconds approx. 10 ms TimeGetTime milliseconds approx. 10 ms QueryPerformanceCounter QueryPerformanceFrequency same [/qoute]
procedure TForm1.FormCreate(Sender: TObject);
begin
T := 20.000;
Timer1.Interval := 1;
Timer1.Enabled := True;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var T:single;
begin
T := T - 0.001;
if T = 0.000 then Timer1.Enabled := false;
end大概是这样吧……
DelphiX组件有一个高速timer,可以直接把interval设为0俺就撸过,啥也不说
T := 60.000;
Min := 20;//整形
在Timer1Timer事件中
是
T := T - 0.001;
if T := 0.000 then
begin
T := 60.000;
Min := Min - 1;
en;;
还有如果按楼上sololie所说,不无道理,实际上要那么大的精度也没用
其实我想做的是百分之一秒。。
汗,那就是10ms,要这么复杂干啥![qoute=引用 msdn:]
操作系统提供了几个精度不同的计时器:
Function Units Resolution
---------------------------------------------------------------------------
Now, Time, Timer seconds 1 second
GetTickCount milliseconds approx. 10 ms
TimeGetTime milliseconds approx. 10 ms
QueryPerformanceCounter QueryPerformanceFrequency same
[/qoute]