📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Timer1: TTimer;
TimeLabel: TLabel;
ProgressBar1: TProgressBar;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
progressstart : bool;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
progressbar1.Position:=progressbar1.Min;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if progressstart =true then
begin
timelabel.Caption:=timetostr(time);
if progressbar1.Position<progressbar1.Max then
progressbar1.StepIt
else
progressbar1.Position:=progressbar1.Min;
end
else
timelabel.Caption :=timelabel.Caption;
progressbar1.Position:=progressbar1.Position;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if button2.Caption ='开始' then
begin
progressstart := true;
button2.Caption :='停止';
end
else
begin
progressstart := false;
button2.Caption :='开始';
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -