ImageEn, unit imageenview

TImageEnView.SetZoomSmooth

TImageEnView.SetZoomSmooth


Declaration

procedure SetZoomSmooth(Zoom: Double; ZoomX: Integer = -1; ZoomY: Integer = -1);


Description

Sets the image zoom (i.e. by setting Zoom), but does so with smooth zoom (image will slowly zoom to the new value).
If ZoomX and ZoomY are not -1 then the zoom will be centered at a specified position (specified in client coordinates). This is like calling ZoomAt.

To control the smoothness/speed set SmoothZoomValue.

Note: You can also use MouseInteractGeneral := miSmoothZoom;


Examples

// Smoothly double the zoom level
ImageEnView1.SetZoomSmooth( ImageEnView1.Zoom * 2 );

// Zoom into the current mouse position
var
  mc: TPoint;
begin
  mc := ImageEnView1.ScreenToClient( Mouse.CursorPos );
  ImageEnView1.SetZoomSmooth( 300, 8, mc.x, mc.y );
end;

// Following code is same as using ImageEnView1.MouseInteractGeneral := miSmoothZoom;
procedure TForm1.ImageEnView1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbLeft then
    ImageEnView1.SetZoomSmooth( ImageEnView1.Zoom * 2 )
  else
  if Button = mbRight then
    ImageEnView1.SetZoomSmooth( ImageEnView1.Zoom / 2 );
end;


See Also

OnFinishSmoothTask
SmoothZoomValue