2 3 4 5 6 7 8 9 10 11 12 | procedure TMainForm.Button1Click(Sender: TObject); begin TThread.CreateAnonymousThread(procedure begin Synchronize(procedure begin Edit1.Text := 'aa'; end ); end ).Start; end; |
2 3 4 5 6 7 8 9 10 11 | procedure TMainForm.Button1Click(Sender: TObject); var t: TThread; begin t := TThread.CreateAnonymousThread(procedure begin ... end ); t.Start; end; |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | type TThreadPlus = class(TThread); ... procedure TMainForm.Button1Click(Sender: TObject); var t: TThread; begin t := TThread.CreateAnonymousThread(procedure begin TThreadPlus(t).Synchronize(procedure begin Edit1.Text := 'aa'; end end ); t.Start; end; |
2 3 4 5 6 7 8 9 10 11 12 13 | procedure TMainForm.Button1Click(Sender: TObject); var t: TThread; begin t:= TThread.CreateAnonymousThread(procedure begin TThread.Synchronize(t, procedure begin Caption := 'aa'; end ); end); t.Start; end; |
联系客服