function Add(ItemClass: TLayerClass): TCustomLayer;
type TLayerClass = class of TCustomLayer;
Adds a new layer to the collection. The layer is added to the end of the list and it's Index property will become equal to Count - 1.
The class of the layer is specified in the ItemClass parameter and you will need to typecast the result to ItemClass if you need to access its specific properties, for example:
var
BL: TBitmapLayer;
begin
BL := TBitmapLayer(MyImage32.Layers.Add(TBitmapLayer));
...
end;
Alternatively, you can use another approach to add layers to the collection:
var
BL: TBitmapLayer;
begin
BL := TBitmapLayer.Create(MyImage32.Layers);
end;