gpt4 book ai didi

delphi - 设置定时器暂停

转载 作者:行者123 更新时间:2023-12-03 14:55:15 24 4
gpt4 key购买 nike

如何在 Delphi 中暂停 TTimer 并保持间隔?因此,例如,我的 TTimer 具有10 秒间隔,当我将计时器设置为在工作的前 7 秒后暂停时,它将保存其状态,然后当我恢复计时器时,它将在剩余 3 秒后触发

非常感谢大家!

最佳答案

Timer.interval :=1000;
ICount:integer;

在创建过程中将 icount 设置为 0

Procedure timerevent(sender:tobject);
Begin
If icount=10 then
Begin
// do proccess
Icount = 0;
End;
Inc(icount);
End;

现在您可以在任何地方停止计时器

关于delphi - 设置定时器暂停,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8479691/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com