Hi Yogi
Actually it looks to be working as expected. If I call:
ImageEnView1.IO.LoadfromFilePSD( 'D:\SampleIn100dpi.psd');
ImageEnView1.LayersDeselectAll;
ImageEnView1.Layers[2].Selected := True;
ImageEnView1.Layers[4].Selected := True;
ImageEnView1.Layers[6].Selected := True;
ImageEnView1.Layers[17].Selected := True;
ImageEnView1.Layers[22].Selected := True;
ImageEnView1.LayersMerge()
It merges all the layers correctly. Because you have selected non-contiguous layers, the merged layers move behind the black boxes in the image. You need to move the black box layers behind the layer (or include them in the selection).
In other words, if you select layer 2 and 4 select and merge them, they will become layer 2. Therefore the layer 4 content is now behind the layer 3 content.
Nigel
Xequte Software
www.imageen.com