Returns the best zoom value to stretch the image to fit within the component. If second overload is used, independent Zoom values are given for x and y (Optionally you can calculate value without the effect of the scrollbars). Cropping specifies the amount of image that can be hidden (top/left of portrait images, or left/right side of landscape images) to better fill the control. This value is a percentage of the difference between the min and max zooms, so 0.0 means no cropping, whereas 1.0 would completely fill the control (see examples below).
// Both the following code snippets will have the same result ImageEnView.Zoom := ImageEnView.GetIdealZoom;
// or ImageEnView.Fit();
// Zoom to fit width ImageEnView.GetIdealZoom( ZoomX, ZoomY ); ImageEnView.Zoom := ZoomX;
// Zoom to fill control by cropping image view (while maintaining the aspect ratio) ImageEnView.GetIdealZoom( ZoomX, ZoomY ); ImageEnView.Zoom := dmax( ZoomX, ZoomY );
// Stretch image to control size without maintaining the aspect ratio ImageEnView.GetIdealZoom( ZoomX, ZoomY ); ImageEnView.ZoomX := ZoomX; ImageEnView.ZoomY := ZoomY;