frmpubwaitprogressunt.pas

来自「EAComps手工画报表 对写报表编辑器有一定的参考价值」· PAS 代码 · 共 95 行

PAS
95
字号
{ 有进度条的窗体 }
unit frmPubWaitProgressUnt;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TfrmPubWaitProgress = class(TForm)
    pbProgress: TProgressBar;
    labProgressMsg: TLabel;
    antAnimate: TAnimate;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  procedure ShowPubWaitProgressDlg(const ACaption, AProgressText: string;
    AMaxPos, AMinPos, APosition: Integer);
  procedure ClosePubWaitProgressDlg;
  procedure AddWaitProgPosition(AIncPos: Integer);
  procedure GotoWaitProgPosition(APosition: Integer);
  procedure UpdateWaitProgCaption(const ACaption: string);
  procedure UpdateWaitProgProgress(const AProgressText: string);


var
  frmPubWaitProgress: TfrmPubWaitProgress;

implementation

{$R *.dfm}

procedure ShowPubWaitProgressDlg(const ACaption, AProgressText: string;
  AMaxPos, AMinPos, APosition: Integer);
begin
  if frmPubWaitProgress = nil then
    frmPubWaitProgress := TfrmPubWaitProgress.Create(Application);
  with frmPubWaitProgress do
  begin
    pbProgress.Max := AMaxPos;
    pbProgress.Min := AMinPos;
    pbProgress.Position := APosition;
    Caption := ACaption;
    labProgressMsg.Caption := AProgressText;
    antAnimate.Active := True;
    Show;
  end;
  Application.ProcessMessages;
end;

procedure ClosePubWaitProgressDlg;
begin
  if frmPubWaitProgress <> nil then
    with frmPubWaitProgress do
    begin
      antAnimate.Active := False;
      Free;
      frmPubWaitProgress := nil;
    end;
end;

procedure AddWaitProgPosition(AIncPos: Integer);
begin
  with frmPubWaitProgress do
    pbProgress.Position := pbProgress.Position + AIncPos;
  Application.ProcessMessages;
end;

procedure GotoWaitProgPosition(APosition: Integer);
begin
  with frmPubWaitProgress do
    pbProgress.Position := APosition;
  Application.ProcessMessages;
end;

procedure UpdateWaitProgCaption(const ACaption: string);
begin
  with frmPubWaitProgress do
    Caption := ACaption;
  Application.ProcessMessages;
end;

procedure UpdateWaitProgProgress(const AProgressText: string);
begin
  with frmPubWaitProgress do
    labProgressMsg.Caption := AProgressText;
  Application.ProcessMessages;
end;

end.

⌨️ 快捷键说明

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