pjdemogrid.pas

来自「GREATIS Print Suite Pro for Delphi (3-7,」· PAS 代码 · 共 61 行

PAS
61
字号
(*          GREATIS PRINT SUITE                 *)
(*  Copyright (C) 2001-2007 Greatis Software    *)
(*      web: http://www.greatis.com             *)
(*  support: http://www.greatis.com/bteam.html  *)

unit PJDemoGrid;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  PJTextGrid, Printers;

type
  TDemoGridPrintJob = class(TTextGridPrintJob)
  private
    { Private declarations }
  protected
    { Protected declarations }
    function GetCellText(APageIndex,ACol,ARow: Integer): string; override;
    function GetCellAlignment(APageIndex,ACol: Integer): TAlignment; override;
    function GetColWidth(TheCanvas: TCanvas; ACol: Integer): Integer; override;
  public
    { Public declarations }
    property RowsPerPage;
  published
    { Published declarations }
  end;

procedure Register;

implementation

function TDemoGridPrintJob.GetCellText(APageIndex,ACol,ARow: Integer): string;
begin
  case ARow of
    rowHeader: Result:=Format('Col: %d',[ACol]);
    rowFooter:
      if ACol=Pred(ColCount) then Result:=Format('Page: %d',[APageIndex])
      else Result:='';
  else Result:=Format('%d.%d',[ACol,ARow]);
  end;
end;

function TDemoGridPrintJob.GetCellAlignment(APageIndex,ACol: Integer): TAlignment;
begin
  Result:=taCenter;
end;

function TDemoGridPrintJob.GetColWidth(TheCanvas: TCanvas; ACol: Integer): Integer;
begin
  Result:=300;
end;

procedure Register;
begin
  RegisterComponents('Print Job Examples', [TDemoGridPrintJob]);
end;

end.

⌨️ 快捷键说明

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