⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time.txt

📁 时钟程序
💻 TXT
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
Ttime = class
private
hour,minute,second:integer;
public
constructor Create;overload;
constructor Create(h,m,s:integer);overload;
procedure Show;
procedure Updata;
end;

var
  Form1: TForm1;
  time:Ttime;


implementation


constructor Ttime.Create(h,m,s:integer);
begin
hour:=h;
minute:=m;
second:=s;
end;

constructor Ttime.Create;
begin
hour:=0;
minute:=0;
second:=0;
end;

procedure Ttime.Show;
var
str:string;
begin
str:='Time:'+inttostr(hour)+':'+inttostr(minute)+':'+inttostr(second)+' ';
form1.ListBox1.Items.Add(str);
end;

procedure Ttime.Updata;
begin
second:=second+1;

if(second=60) then
begin
second:=0;
minute:=minute + 1;
end;

if(minute=60) then
begin
minute:=0;
hour:=hour + 1;
end;

if(hour=24) then
begin
hour:=0;
end;

end;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

time.Show;
time.Updata;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
time:=Ttime.create();
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -