Delphi - 让用户控制容器而不从现有容器继承
我需要使一个控件成为一个类似于 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将 csAcceptsControls 样式添加到控件的 ControlStyle 属性中。在控件类的构造函数中,类似这样的内容:
您几乎肯定还想设置其他 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:
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.