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
 How to update a zoom label after a crop operation?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

864 Posts

Posted - Sep 13 2017 :  17:16:40  Show Profile  Reply
Hello!

I have a TImageEnView with a zoomed image (let's say 80%), and the Zoom percentage is displayed in a label.

Now I CROP a small part of the image.

As a result of the Crop action, the zoom is now 100%.

How can I get an event to update the zoom label? I looked for an event named TImageEnView.OnZoomChange, but it does not exist.

So I tried OnZoomIn and OnZoomOut, but it did not work.

So how can I update the zoom label after the crop operation?

w2m

USA
1990 Posts

Posted - Sep 13 2017 :  17:41:04  Show Profile  Reply
The event you are looking for is ImageEnViewChange:
procedure TForm1.ImageEnViewViewChange(Sender: TObject; Change: Integer);
begin
  TrackBarZoom1.Position := Round(ImageEnView.Zoom);
  UpdateStatusBar;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

PeterPanino

864 Posts

Posted - Sep 13 2017 :  17:48:55  Show Profile  Reply
Thank you, Bill!

While you were writing the answer I also found the OnViewChange event in the documentation:

procedure TFormMain.ImageEnView1ViewChange(Sender: TObject; Change: Integer);
begin  
  if OldImageEditorZoomValue <> ImageEnView1.Zoom then
  begin
    CodeSite.Send('TFormMain.ImageEnView1ViewChange: Zoom has changed');
    UpdateZoomLabel;
    OldImageEditorZoomValue := ImageEnView1.Zoom;
  end;
end;


Would this work in ALL cases where the zoom could change?
Go to Top of Page

xequte

38222 Posts

Posted - Sep 13 2017 :  19:26:57  Show Profile  Reply
Hi

OnViewChange is called by anything that changes the view of the control, so any zoom change will effect OnViewChange.

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