Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
Ronald Ruijs
Posted - Apr 16 2020 : 11:54:14 Hello,
I try to prevent "endless zoomout", resulting in very small image display, by limiting zoomfactor by overriding protected virtual ViewChanging(c: integer; newValue: Double) event.
From the doc, I see that c = 1 for Zoom change. but what is NewValue, and how do I stop zooming out infinitely? I expected that NewValue would be new desired zoomfactor. However, I get negative values for NewValue. Also, how should I prevent further processing? Should that be done by not calling inherited?
Best regards, Ronald
3 L A T E S T R E P L I E S (Newest First)
xequte
Posted - Apr 21 2020 : 18:03:07 Hi Ronald
I've changed the source so that NewValue is now a var parameter. This should work for you if you override the ViewChanging method. Please email me for the update.
Thanks for the explanation, although using a TImageEnView descendant, I would prefer to "build-in" this behaviour by overriding protected methods, rather than using public properties. What is the VieChanging intended use? I could not find a demo that uses it.
Regards, Ronald
xequte
Posted - Apr 20 2020 : 17:41:36 Hi Ronald
You should just use the OnZoomIn/Out events, e.g.
// Max zoom-out to 200%
Procedure Tform1.ImageEnView1ZoomOut(Sender: TObject; var NewZoom: Double);
Begin
if NewZoom > 200 then
NewZoom := 200;
End;