Page 1 of 1

DBSRichViewEdit - Keep zoom when switching to the next doc

Posted: Wed Nov 30, 2016 3:04 pm
by TJ_NOR
Hi
I am using the component to show documents. If i am zooming out and go to my next document i the database the zoom jumps back to 100%
What can i do to solve it? I have tried to keep track of the zoom with a variable but haven't found a event where i can set it back properly.

TJ

Posted: Mon Dec 12, 2016 10:44 am
by Sergey Tkachenko
I suggest to process TDBSRichViewEdit.OnZoomChanged to store the last chosen ZoomPercent, and apply it in TDataSet.AfterScroll:

Code: Select all

ZoomPercent: Single; // defined in the form, initial value 0

procedure TForm1.DBSRichViewEdit1ZoomChanged(Sender: TObject);
begin
  ZoomPercent := DBSRichViewEdit1.ViewProperty.ZoomPercent;
end;

procedure TForm1.FDTable1AfterScroll(DataSet: TDataSet);
begin
  if ZoomPercent > 0 then
    DBSRichViewEdit1.ViewProperty.ZoomPercent := ZoomPercent;
end;