Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can add a custom Color to an TColorBox using the OnGetColors event?

I'm using the OnGetColors event of the TColorBox component, but I can't figure out how add new colors using the Items property of the item parameter of the Event.

procedure (Sender: TCustomColorBox; Items: TStrings) of object;

How I must add new colors to the TColorBox using the Items property?

like image 475
Salvador Avatar asked Jan 17 '12 03:01

Salvador


1 Answers

you must use the AddObject method of the Items object, like so :

procedure TForm1.ColorBox1GetColors(Sender: TCustomColorBox; Items: TStrings);
begin
   Items.AddObject('clWebSnow',TObject(clWebSnow));
end;
like image 56
RRUZ Avatar answered Nov 07 '22 04:11

RRUZ