waitformpas.pas

来自「是一个用delphi设计的考勤系统」· PAS 代码 · 共 59 行

PAS
59
字号
unit WaitFormPas;

interface

uses
  Windows, Messages, SysUtils, WinProcs, Classes, Forms, ExtCtrls;

type
  WaitThread = class(TThread)
  private
    { Private declarations }
    Waitform,temp:Tpanel;
  protected
    procedure Execute; override;
    destructor destroy;override;
  public
    constructor Create(myform:tpanel);virtual;
  end;

implementation

{ Important: Methods and properties of objects in VCL or CLX can only be used
  in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure WaitThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ WaitThread }

constructor WaitThread.Create(myform:tpanel);
begin
   inherited  create(true);
   temp:=myform;
   FreeOnTerminate:=false;
   waitform:=nil;
   resume;
end;

procedure WaitThread.Execute;
begin
  { Place thread code here }
   WaitForm:=Tpanel.Create(temp);
   waitform.Parent :=temp;
   waitform.Caption :='数据处理中,请稍后......';
end;

destructor WaitThread.destroy;
begin
   waitform.Free ;
   inherited
end;
end.
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?