ImageEn, unit imageenview |
|
TImageEnView.AutoShrink
Declaration
property AutoShrink: Boolean;
Description
When enabled the following display rules are used:
◼If an image is bigger than TImageEnView window it is shrunk to fit;
◼If an image is smaller than TImageEnView window it is displayed 100%
Note:
◼Changes will not take effect until you call
Update (or update the display by zooming or loading an image, for example). To make it automatically update, add
iedoDisableAutoFitWhenZoom to
DisplayOptions
◼To fit only to width or height, use
FitMode
◼To automatically crop the view so the image takes up more of the control area, enable
FitCropping
Default: False
procedure TForm1.chkAutoShrinkClick(Sender: TObject);
begin
ImageEnView1.AutoShrink := chkAutoShrink.Checked;
if not chkAutoShrink.Checked then
ImageEnView1.Zoom := 100
else
ImageEnView1.Fit();
end;
// Toggle auto-shrink when pressing the space key
procedure TForm1.ImageEnView1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_SPACE then
begin
ImageEnView1.AutoShrink := not ImageEnView1.AutoShrink;
if not ImageEnView1.AutoShrink then
ImageEnView1.Fit()
else
ImageEnView1.Zoom := 100;
end;
end;
Compatibility Information
Prior to v14.0.0 there was an AutoFit property that set AutoShrink and
AutoStretch. Code that was:
ImageEnView1.AutoFit := True;
Should be changed to:
ImageEnView1.AutoShrink := True;
ImageEnView1.AutoStretch := True;
See Also
◼AutoStretch
◼loFitToLayersWhenZooming
◼iedoDisableAutoFitWhenZoom