rm_progr.pas

来自「report machine 2.3 功能强大」· PAS 代码 · 共 79 行

PAS
79
字号

{*****************************************}
{                                         }
{         Report Machine v2.0             }
{             Progress dialog             }
{                                         }
{*****************************************}

unit RM_progr;

interface

{$I RM.inc}

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, RM_Class, RM_Const;

const
  CM_BeforeModal = WM_USER + 1;

type
  TRMProgressForm = class(TForm)
    btnCancel: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure btnCancelClick(Sender: TObject);
  private
    { Private declarations }
    FReport: TRMReport;
    FOnBeforeModal: TNotifyEvent;
    procedure CMBeforeModal(var Message: TMessage); message CM_BeforeModal;
    procedure Localize;
  public
    { Public declarations }
    FirstCaption: String;
    property OnBeforeModal: TNotifyEvent read FOnBeforeModal write FOnBeforeModal;
    function Show_Modal(AReport: TRMReport): Integer;
  end;

implementation

uses RM_Utils;

{$R *.DFM}

procedure TRMProgressForm.Localize;
begin
	Font.Name := RMLoadStr(SRMDefaultFontName);
  Font.Size := StrToInt(RMLoadStr(SRMDefaultFontSize));
  Font.Charset := StrToInt(RMLoadStr(SCharset));

  btnCancel.Caption := RMLoadStr(SCancel);
end;

function TRMProgressForm.Show_Modal(AReport: TRMReport): Integer;
begin
	Localize;
  FReport := aReport;
  Label2.Caption := '';
  PostMessage(Handle, CM_BeforeModal, 0, 0);
  Result := ShowModal;
end;

procedure TRMProgressForm.btnCancelClick(Sender: TObject);
begin
  FReport.Terminated := True;
  ModalResult := mrCancel;
end;

procedure TRMProgressForm.CMBeforeModal(var Message: TMessage);
begin
  if Assigned(FOnBeforeModal) then
    FOnBeforeModal(Self);
end;

end.

⌨️ 快捷键说明

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