Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent the selection of a specific color in a component TColorBox?

Does anyone know how to remove a certain color from the drop-down list of TColorBox?

enter image description here

like image 813
Andrey Angerchik Avatar asked Dec 06 '25 03:12

Andrey Angerchik


1 Answers

The prefilled ones you can delete from the Items collection. For example:

procedure TForm31.Button1Click(Sender: TObject);
var
  Index: Integer;
begin
  Index := ColorBox1.Items.IndexOfObject(TObject(clGreen));
  if Index <> -1 then
    ColorBox1.Items.Delete(Index);
end;
like image 51
Victoria Avatar answered Dec 07 '25 19:12

Victoria



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!