ImageEn, unit iexLayers

TIELayer.PreferredAspectRatio

TIELayer.PreferredAspectRatio


Declaration

function PreferredAspectRatio(): Double;


Description

Returns the best ratio of Width/Height to display this layer.
Some layer types look best at their original aspect ratio (i.e. the ratio of Height:Width).
This is particularly true of images and some shapes.
Result is 0 if this layer type does not have a preferred aspect ratio.

Typical results:
Portrait image: 0.67
Landscape image: 1.33
Star shape: 1
Text box: 0 (i.e. no preferred ratio)


Example

// Force aspect ratio locking if the object prefers it
ImageEnView1.CurrentLayer.AspectRatioLocked := ImageEnView1.CurrentLayer.PreferredAspectRatio <> 0;


See Also

AspectRatioLocked
RestoreAspectRatio
LayersResizeAspectRatio