Delphi - 让用户控制容器而不从现有容器继承

发布于 2024-09-14 23:22:25 字数 84 浏览 6 评论 0原文

我需要使一个控件成为一个类似于 TPanel 的容器(在设计和运行时保存其他控件),而不从自定义面板或类似控件继承,我如何告诉我的控件它应该包含东西???

I need to make a control a conainter(that holds other controls at design and run time) similiar a TPanel, without inheriting from the custom panel or a similar control, how do i tell my control that its suppose to contain stuff???

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

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

发布评论

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

评论(1

ㄟ。诗瑗 2024-09-21 23:22:25

您需要将 csAcceptsControls 样式添加到控件的 ControlStyle 属性中。在控件类的构造函数中,类似这样的内容:

  ControlStyle := ControlStyle + [csAcceptsControls];

您几乎肯定还想设置其他 ControlStyle 属性,因此不要只逐字记录,而是研究 ControlStyle 标志并决定哪一个适合您的情况。

You need to add the csAcceptsControls style to your control's ControlStyle property. Something like this in the constructor of your control class:

  ControlStyle := ControlStyle + [csAcceptsControls];

You will almost certainly want to set other ControlStyle properties also though so don't just take this verbatim but research the ControlStyle flags and decide which are appropriate in your case.

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