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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to update a zoom label after a crop operation?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Sep 13 2017 : 17:16:40
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?
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 13 2017 : 19:26:57
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
PeterPanino Posted - Sep 13 2017 : 17:48:55
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?
w2m Posted - Sep 13 2017 : 17:41:04
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