Z
zhaohai9
Unregistered / Unconfirmed
GUEST, unregistred user!
怎么button1一按,label1就停了?
unit Unit1;
interface
uses
; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
; Dialogs, StdCtrls;
type
; TForm1 = class(TForm)
; ; Label1: TLabel;
; ; Label2: TLabel;
; ; Button1: TButton;
; ; procedure Button1Click(Sender: TObject);
; ; procedure FormCreate(Sender: TObject);
; private
; ; { Private declarations }
; public
; ; { Public declarations }
; end;
; type
; TMyThread = class(TThread)
; private
; ; { Private declarations }
; protected
; ; procedure Execute; override;
; end;
var
; Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:longint;
e:string;
begin
for i:=0 to 100000000 do
e:=floattostr(i*pi);
label2.Caption:=e;
end;
{ TMyThread }
procedure TMyThread.Execute;
begin
; inherited;
repeat form1.label1.Caption:=timetostr(time) until//sorry,刚才打错了。
terminated;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TMyThread.Create(false);
end;
end.
怎么button1一按,label1就停了?
unit Unit1;
interface
uses
; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
; Dialogs, StdCtrls;
type
; TForm1 = class(TForm)
; ; Label1: TLabel;
; ; Label2: TLabel;
; ; Button1: TButton;
; ; procedure Button1Click(Sender: TObject);
; ; procedure FormCreate(Sender: TObject);
; private
; ; { Private declarations }
; public
; ; { Public declarations }
; end;
; type
; TMyThread = class(TThread)
; private
; ; { Private declarations }
; protected
; ; procedure Execute; override;
; end;
var
; Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:longint;
e:string;
begin
for i:=0 to 100000000 do
e:=floattostr(i*pi);
label2.Caption:=e;
end;
{ TMyThread }
procedure TMyThread.Execute;
begin
; inherited;
repeat form1.label1.Caption:=timetostr(time) until//sorry,刚才打错了。
terminated;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TMyThread.Create(false);
end;
end.
怎么button1一按,label1就停了?