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

📄 depreview.pas

📁 学生学籍管理系统 数据库连接: 1、请在Sql server中附加数据库 2、在ODBC中进行设置 3、在delphi中连接该数据库
💻 PAS
字号:
{
QuickReport打印预览 1.0
作者:罗德江
时间:2001-9-11
地点:广州

功能:代替QuickReport的打印预览功能,完全的中文习惯,完美的中文支持,
      漂亮的外观,是比较完全的打印预览控件。
      1、可以打印当前页或全部;
      2、提供选页打印功能;
      3、提供无级放大功能,鼠标左键每点击一次,自动放大10%;
      4、提供无级缩小功能,鼠标右键第点击一次,自动缩小10%;
      5、支持自定义标题、版权。
      
使用:本控件是基于QuickReport预览,在软件中有三个属性有两个事件:
      1、InQuickRep: TQuickRep 属性,要预览的原始报表格式
      2、InCaption : string 属性,自定义标题,如果不存在,则自动为“打印预览”;
      3、InCopyRight: string 属性,版权定义。
      4、Preview事件,打印预览。
      5、Print事件,打印。
}
unit dePreview;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  printers, DePreU, QuickRpt;

type
  TDePreview = class(TComponent)
  private
    { Private declarations }
    FInQuickRep: TQuickRep;
    FInCaption: string;
    FInCopyRight: string;
    procedure SetInQuickRep(Const Value: TQuickRep);
    Procedure SetInCaption(Const Value: string);
    Procedure SetInCopyRight(Const Value: string);
  protected
    { Protected declarations }
  public
    { Public declarations }
    procedure Preview;
    procedure Print;
  published
    { Published declarations }
    property InQuickRep: TQuickRep Read FInQuickRep write SetInQuickRep;
    property InCaption : string Read FInCaption write SetInCaption;
    property InCopyRight:string Read FInCopyRight write SetInCopyRight;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('德江控件', [TDePreview]);
end;

procedure TDePreview.SetInQuickRep(Const Value: TQuickRep);
begin
  if Value = NIL then
  begin
    showmessage('没有设置报表InQuickRep属性!');
    exit;
  end;
  FInQuickRep := Value;
end;

procedure TDePreview.SetInCaption(Const Value: string);
begin
  if Value = '' then
    FInCaption := '打印预览'
  else
    FInCaption := Value;
end;

procedure TDePreview.SetInCopyRight(Const Value: string);
begin
  if Value = '' then
    FInCopyRight := '德江软件'
  else
    FInCopyRight := Value;
end;

procedure TDePreview.Preview;
begin
//--
  if printer.Printers.Count <= 0 then
  begin
    showmessage('没有安装默认的打印机!');
    exit;
  end;

  frmDePreview := TfrmDePreview.Create(application);
  frmDePreview.WindowState := wsMaximized;
  frmDePreview.Caption := FInCaption;
  frmDePreview.sbText.Panels[0].Text := FInCopyRight;

  FInQuickRep.Prepare;
  frmDePreview.qvMain.QRPrinter := FInQuickRep.QRPrinter;

  frmDePreview.qvMain.Zoom := 100;
  frmDePreview.ShowModal;
  frmDePreview.free;
end;

procedure TDePreview.Print;
begin
  //--
  if printer.Printers.Count <= 0 then
  begin
    showmessage('没有安装默认的打印机!');
    exit;
  end;
  FInQuickRep.print;
end;

end.

⌨️ 快捷键说明

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