Page 1 of 1

TPrintPreview with a public Property PaperView: TPaperPrevi

PostPosted: July 9th, 2010, 6:32 am
by TactiSoft
Hello,

I use your TPrintPreview component. May i suggest you to modify TPrintPreview so that the field FPaperView would becom accessible from outside the component.

TPrintPreview = class(TScrollBox)
private
{...}
FPaperView: TPaperPreview;
{ ...others declarations }

Public
Property PaperView: TPaperPreview read FPaperView;
{...}
end;

Why?:
Because it make sense in some application like mine which create visual objects on the paper area so that they become incorporated in the final Metafile and then be used in a PDF document (i use PDFCreatorPilot http://www.colorpilot.com )

For the moment, and as a 'worth solution' i create an Component derived from yours as this:

unit PreviewEx;

interface

uses Preview;
type

TPrintPreviewEx=class(TPrintPreview)
private
function GetPaperView: TPaperPreview;
public
property PaperView:TPaperPreview read GetPaperView ;
end;

procedure Register;

implementation
uses
Classes,Controls;
procedure Register;
begin
RegisterComponents('Delphi Area', [TPrintPreviewEx]);
end;


{ TPrintPreviewEx }

function TPrintPreviewEx.GetPaperView: TPaperPreview;
var
ctl:TControl;
I:Integer;
begin
result:=NIL;
for i := 0 to self.ControlCount-1 do
begin
ctl:=self.Controls[i];
if ctl is TPaperPreview then
begin
result:=ctl as TPaperPreview ;
break;
end;
end;

end;

end.

Re: TPrintPreview with a public Property PaperView: TPaperP

PostPosted: July 30th, 2010, 4:38 am
by Kambiz
In the next release, the PaperViewControl will serve your needs.

Code: Select all
public
  property PaperViewControl: TPaperView;

Thanks for bringing this issue in my attention.