Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
PeterPanino
Posted - Nov 07 2021 : 11:43:56ImageEnView1.LayersRemove(LYR_SELECTED_LAYERS) sometimes (randomly) removes the BACKGROUND IMAGE together with the selected layer(s).
How can I avoid this?
I now use this workaround to remove the selected layer(s) without removing the background image:
for var i := ImageEnView1.LayersCount - 1 downto 1 do
begin
if ImageEnView1.Layers[i].Selected then
ImageEnView1.LayersRemove(i);
end;
This works. But isn't there a built-in method to achieve this?
4 L A T E S T R E P L I E S (Newest First)
PeterPanino
Posted - Nov 08 2021 : 19:26:40 Thank you!
xequte
Posted - Nov 08 2021 : 17:53:44 Hi Peter
If imgMain.Layers[0].Selectable = False, you can still make a selection (miSelect) on the background image, but you have to make it the active layer with code. If it is selectable then it is at risk of being removed using LayersRemove(LYR_SELECTED_LAYERS).
You can add loProtectBackground to LayerOptions which will protect it from user actions, such as the Delete key. For the next beta, that will also protect it in the case of LayersRemove(LYR_SELECTED_LAYERS).