如何使用OnGetColors事件向TColorBox添加自定义颜色?

时间:2012-01-17 03:18:03

标签: delphi delphi-xe

我正在使用OnGetColors组件的TColorBox事件,但我无法弄清楚如何使用事件的item参数的Items属性添加新颜色。

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

如何使用Items属性向TColorBox添加新颜色?

1 个答案:

答案 0 :(得分:9)

您必须使用Items对象的AddObject方法,如下所示:

procedure TForm1.ColorBox1GetColors(Sender: TCustomColorBox; Items: TStrings);
begin
   Items.AddObject('clWebSnow',TObject(clWebSnow));
end;
相关问题