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
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;
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: