Page 1 of 1

Update current page in TprintPreview

PostPosted: December 3rd, 2003, 9:51 am
by necat
Hi,

I am new here,
My question for TPrintPreview programmers/users.
I create 5 pages works very fine and then change
the fontsize,color etc... on page 4. is it possible
update or refresh page 4 only without creat all
pages again?

ps: sorry for my bad english.

Thanks
Necat Kutlar

PostPosted: December 3rd, 2003, 10:31 am
by Kambiz
Try to use use another instance of TPrintPreview (invisible) to create the 4th page, and then assign the new page to the metafile of the original one.
Code: Select all
PrintPreview.Pages[4].Assign(HiddenPreview.Pages[0]);

PostPosted: December 7th, 2003, 1:21 pm
by necat
Hi,

I tryed your solution, but it does not work. I dont know what I am
missing.

PrintPreview1 is hidden

Code: Select all
PrintPreview1.BeginDoc;
UpdateImageTextPage(pictureName);
PrintPreview1.EndDoc;
PrintPreview.Pages[ PrintPreview.CurrentPage ].Assig(PrintPreview1.Pages[0]);

// update or refresh, It's no odds.



regards,
necat

PostPosted: December 7th, 2003, 2:44 pm
by Kambiz
The component uses an off screen image to draw the current page. So, if you change the content of the current page, you have to repaint the off screen image. For this reason, after the assignment you should call the Repaint method (for both TPrintPreview and TThumbnailView).

The Refresh and Invalidate methods do not update the off screen image.

I hope you are using v4.33 of the component.

Update current page

PostPosted: December 8th, 2003, 1:22 pm
by necat
Hi,

sorry, it does not work.
PrintPreview1 is the invisible and
I am using v4.33 of the component.

Code: Select all
procedure TMainForm.UpdateImageOnlyPage;
var
  R: TRect;
begin
  with PrintPreview1 do
  begin
    R := PageBounds;
    with ConvertXY(150, 150, mmLoMetric, Units) do InflateRect(R, -X, -Y);

    BeginDoc;
    Image2.Picture.LoadFromFile('test.jpg');
    PaintGraphicEx(R, Image2.Picture.Graphic, True, False, True);
    EndDoc;

    PrintPreview.Pages[2].Assign(PrintPreview1.Pages[0]);

    PrintPreview.Repaint;
    ThumbnailPreview1.Repaint;
  end;
end;



regards,
necat

PostPosted: December 8th, 2003, 10:28 pm
by Kambiz
Please download the update.

By the way, there's no need anymore to call Repaint method for both of TPrintPreview and TThumbnailView components.

It works.

PostPosted: December 9th, 2003, 9:46 am
by necat
Hi,

Fine, thank you very much.

in your component, I could not find any function,
about how I can delete a page or pages!

is it not possible? I need it.

regards,
necat

PostPosted: December 9th, 2003, 11:11 am
by Kambiz
Currently none of these features are available. In the next release I'll include them.