ImageEn, unit iexLayers

TIELayer.AspectRatioLocked

TIELayer.AspectRatioLocked


Declaration

property AspectRatioLocked: Boolean;


Description

When enabled the PreferredAspectRatio for the layer will be enforced regardless of the setting for LayersResizeAspectRatio.

Note:
You may want to call RestoreAspectRatio before enabling AspectRatioLocked if you want to lock to the best AR for this layer
Dragging grips other than the corner will still allow users to skew the image. To avoid this use ShiftKeyLock
AspectRatioLocked has no effect with line layers

Default: False (Except for TIEAngleLayer, where default is true)


Examples

// Lock layer to the current aspect ratio
ImageEnView1.CurrentLayer.AspectRatioLocked := True;

// Force aspect ratio locking if the object prefers it
if ImageEnView1.CurrentLayer.PreferredAspectRatio <> 0 then
begin
  ImageEnView1.CurrentLayer.RestoreAspectRatio( True);
  ImageEnView1.CurrentLayer.AspectRatioLocked := True;
  ImageEnView1.Update();
end;


// Add a "Shape" layer with vertically offset text
ImageEnView1.LayersAdd( ielkText, 200, 200, 230, 200 );
ImageEnView1.CurrentLayer.AspectRatioLocked            := True;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderShape  := iesHeart;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderWidth  := 0;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderColor  := clNone;
TIETextLayer( ImageEnView1.CurrentLayer ).FillColor    := $004646FF;
TIETextLayer( ImageEnView1.CurrentLayer ).Font.Style   := [fsBold];
TIETextLayer( ImageEnView1.CurrentLayer ).Alignment    := iejCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).Layout       := ielCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).WordWrap     := False;
TIETextLayer( ImageEnView1.CurrentLayer ).Text         := 'I Heart Delphi';
TIETextLayer( ImageEnView1.CurrentLayer ).Font.Size    := 22;
TIETextLayer( ImageEnView1.CurrentLayer ).TextOverflow := ieoShrink;
TIETextLayer( ImageEnView1.CurrentLayer ).TextOffsetY  := -0.15;
ImageEnView1.LayersTextRotateMode                      := iermBoth;
ImageEnView1.Update();