美文网首页
Delphi多线程

Delphi多线程

作者: 风语007 | 来源:发表于2016-08-24 18:02 被阅读0次

MyThread = class(TThread)
  private
    procedure Execute;override;
  end;

procedure MyThread.Execute;
var
  i: integer;
begin
  for i:=0 to 20 do
  begin

//原因类似于oc,oc的标记变量需要手工定义,delphi不需要定义
    if not Terminated then
    begin
      Form1.Edit1.Text := IntToStr(i);
      Sleep(500);
    end
    else
      Break;
  end;

end;

if Assigned(tt) then
  begin
//    会首先把Terminated 这个变量=false
    tt.Free;
  end;

相关文章

网友评论

      本文标题:Delphi多线程

      本文链接:https://www.haomeiwen.com/subject/uzalrttx.html