S
shopman
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
Tmylabel=class(TThread)
private
FFlabel: Tlabel;
ii:integer;
procedure labelcount;
protected
procedure Execute;
override;
public
constructor Create(Flabel:Tlabel);
end;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure Tmylabel.Execute ;
var
i:integer;
begin
for i:=0 to 5000do
begin
ii:=i;
Synchronize(labelcount);
end;
end;
constructor Tmylabel.Create(Flabel:Tlabel);
begin
FFlabel:=Flabel;
FreeOnTerminate := True;
inherited Create(False);
end;
procedure Tmylabel.labelcount ;
begin
FFlabel.Caption :=inttostr(ii);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Tmylabel.Create(form1.label1);
Tmylabel.Create(form1.label2);
end;
end.
它运行之后我想点击任何一个label它能停下。
请指点!!!
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
Tmylabel=class(TThread)
private
FFlabel: Tlabel;
ii:integer;
procedure labelcount;
protected
procedure Execute;
override;
public
constructor Create(Flabel:Tlabel);
end;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure Tmylabel.Execute ;
var
i:integer;
begin
for i:=0 to 5000do
begin
ii:=i;
Synchronize(labelcount);
end;
end;
constructor Tmylabel.Create(Flabel:Tlabel);
begin
FFlabel:=Flabel;
FreeOnTerminate := True;
inherited Create(False);
end;
procedure Tmylabel.labelcount ;
begin
FFlabel.Caption :=inttostr(ii);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Tmylabel.Create(form1.label1);
Tmylabel.Create(form1.label2);
end;
end.
它运行之后我想点击任何一个label它能停下。
请指点!!!