模拟数字时钟

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    RadioGroup1: TRadioGroup;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  timer1timer(sender);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  case radiogroup1.ItemIndex of
    0:label1.Caption := formatdatetime('ampm hh:nn:ss',time);
    1:label1.Caption := formatdatetime('hh:nn:ss',time);
  end;
end;

end.

 

posted @ 2011-12-06 08:45  endsnow  阅读(128)  评论(0编辑  收藏  举报