Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Position and size of a print preview

edited October 2006 in General
I can set zoom and window state for print preview window like this:

procedure TMainForm.ppReport1PreviewFormCreate(Sender: TObject);
begin
ppReport1.PreviewFormSettings.ZoomSetting := zsPercentage;
ppReport1.PreviewFormSettings.ZoomPercentage := 100;
ppReport1.PreviewFormSettings.WindowState := wsMaximized;
end;

How can I set position and a size?

There is ppReport1.PreviewForm.Top/Height/Width properties, but it
looks like they are read only. If I set it in
ppReport1PreviewFormCreate it does not have any effect.


Thanks
Zoran

Comments

  • edited October 2006
    Try:

    TppCustomReport(Sender).PreviewForm.Viewer

    That is the actual TForm object you are seeing. Set the properties in there.

    HTH,
    Ed Dressel
    Team DM
  • edited October 2006
    That's what I was doing (bottom part of my initial post), but it does not do
    anything. Print preview form still pops up in the middle of the screen and
    in default size.

    RB 10.02, BDS 2006



  • edited October 2006
    You might want to assign the

    TppCustomReport(Sender).PreviewForm.Viewer.OnShow

    to an method and assign the values there.

    HTH,
    Ed Dressel
    Team DM
  • edited October 2006
    Nothing happens in OnShow, but OnActivate does the trick.

    Thanks Ed.



    On Sat, 28 Oct 2006 19:58:41 -0700, "Ed Dressel [Team DM]"
  • edited October 2006
    All I did was:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    procedure TrptHHIndVisList.ppRptHHIndVisListPreviewFormCreate(
    Sender: TObject);
    begin
    with TppReport(Sender).PreviewForm do begin
    position := poDesigned;
    windowstate := wsNormal;
    Height := 900;
    width := 900;
    Top := 100;
    left := 200;
    end;
    end;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    It seems to work for me...

    JonD

  • edited October 2006

    Hi Jon

    I did this before, but without "position := poDesigned" and it didn't
    work. Now with it -- it works fine! Probably default was "position :=
    poScreenCenter" and it was overwriting my settings for
    Top/Left/Width/Height.

    Thanks.


    On Sun, 29 Oct 2006 11:24:53 -0500, Jon Lloyd Duerdoth
  • edited October 2006
    Been there.... done that :-)

    JonD

This discussion has been closed.