ImageEn, unit imageenview

TImageEnView.LayersRemove

TImageEnView.LayersRemove


Declaration


procedure LayersRemove(LyrIndex: Integer = LYR_SELECTED_LAYERS; SwapBackgroundProps: Boolean = False);


Description


Removes a layer and frees the related bitmap. You can specify the index of a layer of LYR_SELECTED_LAYERS to remove all selected layers.
Parameter Description
idx Index of the layer to remove (0 = background/first layer). You can also specify LYR_SELECTED_LAYERS or LYR_ALL_LAYERS (which will call LayersClear)
SwapBackgroundProps If the background layer (Layer 0), the new background will inherit the Locked and Selectable properties of the old one


Note: At least one layer must be present. Attempting to remove the final layer will empty its content.


Example


// Remove all selected layers
ImageEnView1.LayersRemove();

// Remove the top-most layer
ImageEnView1.LayersRemove( ImageEnView1.LayersCount - 1 );

// Remove any image layers (except background)
ImageEnView1.LockUpdate;
for I := ImageEnView1.LayersCount - 1 downto 1 do
  if ImageEnView1.Layers[ I ] is TIEImageLayer then
    ImageEnView1.LayersRemove( I );
ImageEnView1.UnlockUpdate();


See Also


- LayersClear