📄 formwait.pas
字号:
{*******************************************************}
{ }
{ 请等待 }
{ }
{ 版权所有 (C) 2007 咏南工作室(陈新光) }
{ }
{*******************************************************}
unit FormWait;
interface
uses
Windows, Classes, Controls, Forms,
ExtCtrls, StdCtrls, ComCtrls, Buttons;
type
TFrmWait = class(TForm)
Label1: TLabel;
Timer1: TTimer;
Bevel1: TBevel;
ani1: TAnimate;
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: TFrmWait;
end;
procedure ShowWaitText(Text: string='');
var
FrmWait: TFrmWait;
implementation
{$R *.dfm}
procedure ShowWaitText(Text: string='');
begin
//执行等待窗口的文字
if not assigned(FrmWait) then
FrmWait := TFrmWait.Create(Application);
FrmWait.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 TFrmWait.GetMsg: string;
begin
Result := Label1.Caption;
end;
procedure TFrmWait.SetMsg(const Value: string);
begin
if Label1.Caption<>Value then Label1.Caption := Value;
if Value = '' then
begin
Ani1.Active := False;
Timer1.Enabled := False;
Hide;
end else begin
if not Self.Showing then
show;
if not Ani1.Active then
Ani1.Active := True;
Self.Update;
end;
end;
procedure TFrmWait.Timer1Timer(Sender: TObject);
begin
if self.Showing then
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 + -