⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wait.pas

📁 仲裁委仲裁案件计酬程序.有基础资料设置、分级设置
💻 PAS
字号:
unit Wait;

interface

uses
  Windows, Classes, Controls, Forms,
   ExtCtrls, StdCtrls, ComCtrls;

type
  TWaitFrm = class(TForm)
    Animate1: TAnimate;
    Label1: TLabel;
    Timer1: TTimer;
    Bevel1: TBevel;
    procedure Timer1Timer(Sender: TObject);
  private
    function GetMsg: string;
    procedure SetMsg(const Value: string);
    { Private declarations }
  public
    property Msg: string read GetMsg write SetMsg;
    { Public declarations }
  end;

  TWaitForm = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  public
    AForm: TWaitFrm;
  end;

procedure ShowWaitText(Text: string='');

var
  WaitFrm: TWaitFrm;

implementation

{$R *.dfm}

procedure ShowWaitText(Text: string='');
begin
  // 执行等待窗口的文字
  if not assigned(WaitFrm) then
    WaitFrm := TWaitFrm.Create(Application);
  WaitFrm.Msg := Text;
end;

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

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

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

{ TWaitForm }

procedure TWaitForm.Execute;
begin
  { Place thread code here }
end;

function TWaitFrm.GetMsg: string;
begin
  Result := Label1.Caption;
end;

procedure TWaitFrm.SetMsg(const Value: string);
begin
  Label1.Caption := Value;

  if Value = '' then
  begin
    Animate1.Active := False;
    Timer1.Enabled := False;
    Hide;
  end
  else
  begin
    if not Self.Showing then
      show;
    if not Animate1.Active then
      Animate1.Active := True;
 //   Timer1.Enabled := True;
    Self.Update;
  end;

end;

procedure TWaitFrm.Timer1Timer(Sender: TObject);
begin
  if self.Showing then
    //    Application.ProcessMessages;
    RedrawWindow(self.Handle, nil, 0, RDW_FRAME +
      RDW_INVALIDATE +
      RDW_ALLCHILDREN + RDW_NOINTERNALPAINT);
end;

end.

⌨️ 快捷键说明

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