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
 Best way to set a minimum zoom level

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
bmesser Posted - Feb 05 2013 : 09:34:25
Hi

I have put in place a minimum zoom level like this...

procedure ImageViewChange(Sender: TObject; Change: Integer);
begin
  if Image.Zoom<50 then Image.Zoom:=50;
end;


I am getting fairly picky now and although it works, when the zoom is 50 and the user tries to go lower the zoom level, the overall effect is that the image 'bounces' between two zoom levels - is there any way I can stop that and don't do anything or is that how it is?

I've tried the
OnChanging
event without any luck either and there doesn't seem to be a minimum zoom level you can set which would solve my problem.

Bruce.
6   L A T E S T    R E P L I E S    (Newest First)
bmesser Posted - Feb 07 2013 : 06:54:02
Thanks Nigel I'll give that a go!
xequte Posted - Feb 06 2013 : 22:01:07
And how about including a stop for "Fit to Window" (untested):
procedure TfmMain.ImageMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
var
  iNewZoom : Double;
begin
  iNewZoom := Image.Zoom;
  if WheelDelta > 0 then
  begin
    iNewZoom := iNewZoom * 1.1;
    if (Image.GetIdealZoom > Image.Zoom) and
       (Image.GetIdealZoom < iNewZoom) then
      iNewZoom := Image.GetIdealZoom;
  end
  else
  if iNewZoom > 50 then 
  begin
    iNewZoom := iNewZoom * 0.9;
    if (Image.GetIdealZoom > iNewZoom) and
       (Image.GetIdealZoom < Image.Zoom) then
    iNewZoom := Image.GetIdealZoom;
  end;

  Image.Zoom := iNewZoom;  
  handled := True;
end;



Also see:
http://www.imageen.com/help/TImageEnView.ZoomIn.html
http://www.imageen.com/help/TImageEnView.ZoomOut.html


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
bmesser Posted - Feb 06 2013 : 10:40:59
procedure TfmMain.ImageMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
  if WheelDelta<0 then
  begin
    if Image.Zoom>50 then Image.Zoom:=Image.Zoom*0.9;
  end
  else Image.Zoom:=Image.Zoom*1.1;

  handled:=True;
end;
w2m Posted - Feb 06 2013 : 09:17:34
You said you "take control of zooming myself". I am curious. How did you eliminate the bounce?

William Miller
bmesser Posted - Feb 06 2013 : 02:36:21
Hi Bill

I didn't want to use any extra controls and just rely on the mouse & keyboard. What I've done is disable the mouse wheel and take control of zooming myself - in that way zooming now just stops if its less than 50% and you don't get the 'bounce' as it resets back exactly to 50%.

Bruce.
w2m Posted - Feb 05 2013 : 10:06:04
If you use a TTrackbar or TSpinEdit to adjust the zoom the best way is to set the min property to 50. This way you do not get any flicker at all. At this point I do not see a way to eliminate flicker, but you might try:
procedure TForm1.ImageEnView1ViewChange(Sender: TObject; Change: Integer);
begin
  if Change = 1 then
  begin
    if ImageEnView1.Zoom < 50 then
      ImageEnView1.Zoom := 50;
  end;
  cxTrackBarZoom1.Position := Round(ImageEnView1.Zoom);
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html