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

发布于 2024-12-27 12:03:59 字数 335 浏览 3 评论 0 原文

我正在使用 OnGetColors 事件“http://docwiki.embarcadero.com/Libraries/en/Vcl.ExtCtrls.TColorBox”rel="noreferrer">TColorBox 组件,但我不知道了解如何使用事件的 item 参数的 Items 属性添加新颜色。

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆依然 2025-01-03 12:03:59

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

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

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文