问题
I'm creating simple component inherited from TControl (Firemonkey). In constructor I wrote :
constructor TControl1.Create(AOwner: TComponent);
begin
inherited;
fTest := TLayout.Create(Self);
fTest.Parent := Self;
end;
How when I place this component to the form, Structure list shows Tlayout as subcomponent as <components1>. How can I hide it? See screenshot.
回答1:
Use
SetSubComponent(True);Ownermust beSelf
constructor TControl1.Create(AOwner: TComponent);
begin
inherited;
fTest := TLayout.Create(Self);
fTest.SetSubComponent(True);
fTest.Parent := Self;
end;
Here is also similar question:
How to disable child controls at design-time?
来源:https://stackoverflow.com/questions/50202133/how-to-hide-subcomponents-in-design-time-in-structure-view-panel-when-creating-o