Hej,
her er et lille eksempel, du skal bruge en knap og en timer.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, DateUtils;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
startTidspunkt : Tdatetime;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
startTidspunkt := now();
timer1.Enabled := true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
sekunder:integer;
minutter:integer;
begin
sekunder := SecondsBetween( now() , startTidspunkt );
minutter := sekunder div 60;
sekunder := sekunder mod 60;
form1.caption:= inttostr(minutter)+':'+inttostr(sekunder);
end;
end.
MvH
Stefan Svensson
http://fusket.frac.dk