Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在设计一个自定义控件,每次我在表单设计器中突出显示它,然后从控件面板中选择另一个控件时,新的控件最终都会出现在我的控件中,就好像它是一个 TPanel 或 TGroupBox。这不是我想要的,所以我怎样才能避免它发生呢?
您需要csAcceptsControls从属性中删除标志ControlStyle,最好直接在构造函数中:
csAcceptsControls
ControlStyle
constructor TMyComponent.Create(AOwner: TComponent); begin inherited Create(AOwner); ControlStyle := ControlStyle - [csAcceptsControls]; // more initialization stuff ... end;