type
MyThread=class(TThread)
private
protected
procedure Execute; override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i:mythread;
begin
i:=mythread.Create;
end;
{ MyThread }
procedure MyThread.Execute;
var i:integer;
begin
inherited;
FreeOnTerminate:=true;
for I := 0 to 80000 do begin
form1.Edit1.Text:=inttostr(i);
form1.Edit1.Refresh;
end;
end;
点击 button1时,edit1中每次出现不同的数值,都不是80000
...全文
2455打赏收藏
delphi xe中使用线程出现问题
type MyThread=class(TThread) private protected procedure Execute; override; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var i:mythread; begin i:=mythread.Create; end; { MyThread } procedure MyThre