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

📄 unit1.pas

📁 一个用Delphi写的时钟程序
💻 PAS
字号:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Button1: TButton;
    procedure Timer1Timer(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  i:integer;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
   if i>=10 then
   begin
     i:=0;
     label2.Caption:=timetostr(now);
     i:=i+1;
   end
   else if i=0 then
   begin
     label2.Caption:=timetostr(now);
     i:=i+1;
   end
   else if i=1 then
        begin
          label3.Caption:=timetostr(now);
          i:=i+1;
        end
        else if i=2 then
             begin
               label4.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=3 then
             begin
               label5.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=4 then
             begin
               label6.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=5 then
             begin
               label7.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=6 then
             begin
               label8.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=7 then
             begin
               label9.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=8 then
             begin
               label10.Caption:=timetostr(now);
               i:=i+1;
             end
             else if i=9 then
             begin
               label11.Caption:=timetostr(now);
               i:=i+1;
             end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  label1.Caption:=timetostr(now);
end;

end.

⌨️ 快捷键说明

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