I am trying to add a custom color to a TColorBox control. I've added the control to my form and for the Style property, set cbCustomColor to True. For the OnGetColors event, I have the following code:
procedure TfrmAbout.GetColors(Sender: TCustomColorBox; Items: TStrings);
begin
ShowMessage('GetColors has been triggered');
Items.AddObject('clWebSnow',TObject(clWebSnow));
Items.AddObject('MyOrange',TObject(Rgb(255,128,0)));
end;
I don't see the messagebox or the colors appearing in the dropdown. Is there anything else I need to do in order to get this to work?
You need to include the cbCustomColors option to the Style property to enable adding of your own custom colors instead. The cbCustomColor option only includes the item, which allows you to select a custom color.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With