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.