我正在使用 Delphi 7 创建程序。我有一个名为 CoinsEdit 的输入框。当用户单击提交时,他们必须等待的秒数将为
CoinsEdit.text div 30 + 2
. 我让它显示他们必须等待的分钟数和秒数,但我希望它能够实时倒计时。我还想要一个进度条来配合它。所有这些都将在一个对话框中。并且“确定”按钮应该被禁用,直到加载完成。到目前为止我所拥有的:
procedure TForm1.onConnected;
var
amount: string;
user: string;
pass: string;
begin
amount := CoinsEdit.text;
user := UserEdit.text;
pass := PassEdit.text;
Form1.Visible := False;
ShowMessage('Please wait for ' + Seg2Min(StrToInt(CoinsEdit.text) div 30 + 2));
ShowMessage(user + ', ' + Trim(amount) + ' coins have been added to your ' +
'account.');
Form1.Visible := True;
UserEdit.Text := '';
PassEdit.Text := '';
CoinsEdit.Text := '';
end;
Seg2Min 是一个将秒转换为分钟和秒的函数。这是功能:
Min := Seg div 60;
Rest := Seg - (Min*60);
if Min = 0 then
Seg2Min:= FormatFloat('0', Rest) + ' seconds'
else
Seg2Min:= FormatFloat('0', Min) + ' minutes and ' + FormatFloat('0', Rest) +
' seconds';
如何使用 aTTimer
并将其用于倒计时?