ImageEn, unit iexLayers

TIELayer.Width

TIELayer.Width


Declaration

property Width: Integer;


Description

Specifies the layer size (i.e. display width when zoom is 100%).
WidthD provides a double version of Width if you need more accuracy.

Note: For image layers, setting width before loading will ensure the loaded image does not exceed the current layer dimensions


Examples

// Make all selected layers 1/3 size
ImageEnView1.LockUpdate;
for i := 0 to ImageEnView1.LayersCount - 1 do
  if ImageEnView1.Layers[ I ].Selected then
  begin
    ImageEnView1.Layers[ I ].Width  := ImageEnView1.Layers[ I ].Width div 3;
    ImageEnView1.Layers[ I ].Height := ImageEnView1.Layers[ I ].Height div 3;
  end;
ImageEnView1.LayersFixSizes( LYR_SELECTED_LAYERS );
ImageEnView1.UnlockUpdate;


// Set width to 600 while maintaining AR
ar := ImageEnView1.Layers[idx].Width / ImageEnView1.Layers[idx].Height
ImageEnView1.Layers[idx].Width  := 600;
ImageEnView1.Layers[idx].Height := Round( 600 / ar );
ImageEnView1.Update();


// Set height to 600 while maintaining AR
ar := ImageEnView1.Layers[idx].Width / ImageEnView1.Layers[idx].Height
ImageEnView1.Layers[idx].Width  := Round( 600 * ar );
ImageEnView1.Layers[idx].Height := 600;
ImageEnView1.Update();


// Load image so it fits within the current layer dimensions
lyr := TIEImageLayer(ImageEnView1.CurrentLayer);
// Lock image layer size
lyr.Width  := lyr.Width;
lyr.Height := lyr.Height;
ImageEnView1.IO.LoadFromFile( 'D:\image.jpg' );
lyr.RestoreAspectRatio();


See Also

PosX
PosY
Height
LayerRect
ClientAreaBox
LayersSizeAll
SizeToText