ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ViewChanging event
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Ronald Ruijs

Netherlands
24 Posts

Posted - Apr 16 2020 :  11:54:14  Show Profile  Reply
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

xequte

38222 Posts

Posted - Apr 20 2020 :  17:41:36  Show Profile  Reply
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;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Ronald Ruijs

Netherlands
24 Posts

Posted - Apr 21 2020 :  16:51:06  Show Profile  Reply
Hi Nigel,

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

Go to Top of Page

xequte

38222 Posts

Posted - Apr 21 2020 :  18:03:07  Show Profile  Reply
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.

Note: Change = 2 is for zoom changes.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: