So why do you create another TBrighnessAdjustmentLayer then?
This should work (I removed the 'create' and got rid of some begin/end and other unimportant stuff):
Delphi-Quellcode:
var
Index: Integer;
Layer: TCustomFilterLayer;
begin
Index := lbLayers.ItemIndex;
if Index <> - 1 then
if lbLayers.Items.Objects[Index] is TCustomFilterLayer then begin
Layer := lbLayers.Items.Objects[Index] as TCustomFilterLayer;
if Layer is TBrightnessAdjustmentLayer then
SetAmount(vtInteger, -100, 100, TBrightnessAdjustmentLayer(Layer).Amount);
end;
end;