asprev.pas

来自「delphi的超级好用的表格控件」· PAS 代码 · 共 53 行

PAS
53
字号
unit asprev;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, AdvGrid, Grids, AdvListv;

type
  TPagePreview = class(TForm)
    PaintBox1: TPaintBox;
    procedure PaintBox1Paint(Sender: TObject);
  private
    {
    asg:tAdvStringGrid;
    }
    prevctrl:tcomponent;
    { Private declarations }
  public
    {
    constructor Create(aOwner:tComponent; aStringGrid:tAdvStringGrid);
    }
    constructor Create(aOwner:tComponent; aComp:Tcomponent );

    { Public declarations }
  end;

var
  PagePreview: TPagePreview;

implementation

{$R *.DFM}

constructor TPagePreview.Create(aOwner:tComponent; acomp:tcomponent);
begin
 inherited Create(aOwner);
 prevctrl:=acomp;
end;

procedure TPagePreview.PaintBox1Paint(Sender: TObject);
var
 t:integer;
begin
 if prevctrl is TAdvStringGrid then
  (prevctrl as TAdvStringGrid).printpreview(paintbox1.canvas,paintbox1.clientrect);

 if prevctrl is TAdvListView then
  (prevctrl as TAdvListView).preview(paintbox1.canvas,paintbox1.clientrect);
end;

end.

⌨️ 快捷键说明

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