开发者

Delphi - Making a user control a container without inheriting from an existing container

开发者 https://www.devze.com 2023-01-12 13:47 出处:网络
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,开发者_如何学C how do i tell my

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,开发者_如何学C how do i tell my control that its suppose to contain stuff???


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号