📄 uwaiting.pas
字号:
unit uWaiting;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Forms, ComCtrls;
type
TWaiting = class
private
{ Private declarations }
FForm: TForm;
FProgressBar: TProgressBar;
function GetMaxValue: Integer;
procedure SetMaxValue(AValue: Integer);
procedure SetPosition(AValue: Integer);
public
{ Public declarations }
constructor Create(AOwner: TComponent);
destructor Destroy; override;
procedure Show;
procedure Update;
published
property iMax: Integer read GetMaxValue write SetMaxValue;
property iPosition: Integer write SetPosition;
end;
var
Waiting: TWaiting;
implementation
{ TWaiting }
constructor TWaiting.Create(AOwner: TComponent);
begin
if not Assigned(FForm) then
begin
FForm := TForm.Create(AOwner);
with FForm do
begin
FormStyle := fsStayOnTop;
BorderStyle := bsNone;
Color := $00FFACAC;
Position := poScreenCenter;
AutoSize := True;
end;
FProgressBar := TProgressBar.Create(FForm);
FProgressBar.Width := 275;
FProgressBar.Parent := FForm;
end;
end;
destructor TWaiting.Destroy;
begin
if Assigned(FProgressBar) then FreeAndNil(FProgressBar);
if Assigned(FForm) then FreeAndNil(FForm);
inherited;
end;
function TWaiting.GetMaxValue: Integer;
begin
Result := FProgressBar.Max;
end;
procedure TWaiting.SetMaxValue(AValue: Integer);
begin
if FProgressBar.Max <> AValue then FProgressBar.Max := AValue;
end;
procedure TWaiting.SetPosition(AValue: Integer);
begin
FProgressBar.Position := AValue;
end;
procedure TWaiting.Show;
begin
FForm.Show;
FProgressBar.Show;
end;
procedure TWaiting.Update;
begin
FForm.Update;
FProgressBar.Update;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -