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

📄 qm_pquickrep.pas

📁 一个管理系统
💻 PAS
字号:
{*******************************************************}
{                                                       }
{                   QReportMaker 2.0                    }
{              TQMPrintQuickRep Component               }
{                                                       }
{            Copyright (c) 2003,2004 by Zwm.            }
{                                                       }
{*******************************************************}

unit QM_PQuickRep;

interface


uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, ExtCtrls, QM_DCtrl;

type
  { TQMPrintQuickRep }
  TQMPrintQuickRep = class(TComponent)
  private
    FPage: TQMPage;
    FSection: String;
    FQuickRep: TCustomPanel;
    procedure SetPage(const Value: TQMPage);
    procedure SetQuickRep(const Value: TCustomPanel);
    procedure SetSection(const Value: String);
  protected
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Preview;
    procedure Print;
    function PageSetup: Boolean;
    procedure ReDraw;
  published
    property QuickRep: TCustomPanel read FQuickRep write SetQuickRep;
    property Section: String read FSection write SetSection;
    property Page: TQMPage read FPage write SetPage;
  end;

implementation

uses QuickRpt, QRPrntr, QM_Utils, QM_Prvfrm, QM_QRFuns;

{ TQMPrintQuickRep }

constructor TQMPrintQuickRep.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FPage := TQMPage.Create;
  Section := ClassName + FormatDateTime('mmsszzz', time);
end;

destructor TQMPrintQuickRep.Destroy;
begin
  FPage.Free;
  inherited Destroy;
end;

procedure TQMPrintQuickRep.Notification(AComponent: TComponent;
  Operation: TOperation);
begin
  inherited Notification(AComponent, Operation);
  if (Operation = opRemove) and (AComponent = FQuickRep) then FQuickRep := nil;
end;

function TQMPrintQuickRep.PageSetup: Boolean;
begin
  Result := QM_PageSetup(self, True);
end;

procedure TQMPrintQuickRep.Preview;
var
  tmpFrm: TQMPreviewForm;
begin
  if (QuickRep = nil) or (not (QuickRep is TQuickRep)) then exit;
  tmpFrm := TQMPreviewForm.Create(nil);
  try
    if not (csDesigning in ComponentState) then QM_LoadSetting(self);
    with tmpFrm do
    begin
      QMReportConsole := self;
      QM_QRep := TQuickRep(QuickRep);
      QMQuickRep := QM_QRep;
      QM_QRep.OnPreview := QM_QRepOnPreview;
      QM_ApplySetting(self);
      QM_QRep.PreviewModal;
      ShowModal;
    end;
  finally
    tmpFrm.Free;
  end;
end;

procedure TQMPrintQuickRep.Print;
begin
  if (QuickRep = nil) or (not (QuickRep is TQuickRep)) then Exit;
  if not (csDesigning in ComponentState) then QM_LoadSetting(self);
  QMQuickRep := TQuickRep(QuickRep);
  QM_ApplySetting(self);
  QMQuickRep.Print;
end;

procedure TQMPrintQuickRep.ReDraw;
begin
  if (QuickRep = nil) or (not (QuickRep is TQuickRep)) then Exit;
  QMQuickRep := TQuickRep(QuickRep);
  QM_ApplySetting(self);
end;

procedure TQMPrintQuickRep.SetPage(const Value: TQMPage);
begin
  FPage.Assign(Value);
end;

procedure TQMPrintQuickRep.SetQuickRep(const Value: TCustomPanel);
begin
  if (Value <> nil) and (not (Value is TQuickRep)) then
    FQuickRep := nil
  else
    FQuickRep := Value;
  if Value <> nil then Value.FreeNotification(Self);
end;

procedure TQMPrintQuickRep.SetSection(const Value: String);
begin
  if Value ='' then
    FSection := ClassName + FormatDateTime('mmsszzz', time)
  else FSection := Trim(Value);
end;

end.

⌨️ 快捷键说明

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