【问题标题】:How to hide subcomponents in design time in Structure view panel when creating own component (hide <components[1]>)创建自己的组件时如何在设计时在结构视图面板中隐藏子组件(隐藏 <components[1]>)
【发布时间】:2018-10-16 13:08:06
【问题描述】:

我正在创建从 TControl (Firemonkey) 继承的简单组件。 在构造函数中我写道:

constructor TControl1.Create(AOwner: TComponent);
begin
  inherited;

  fTest := TLayout.Create(Self);
  fTest.Parent := Self;
end;

当我将此组件放置到表单时,结构列表如何将布局显示为子组件,如 1>。我该如何隐藏它? 见截图。

【问题讨论】:

    标签: delphi


    【解决方案1】:

    使用

    1. SetSubComponent(True);

    2. Owner 必须是Self

    constructor TControl1.Create(AOwner: TComponent);
    begin
      inherited;
    
      fTest := TLayout.Create(Self);
      fTest.SetSubComponent(True);
      fTest.Parent := Self;
    end;
    

    这里也有类似的问题:

    How to disable child controls at design-time?

    【讨论】:

      猜你喜欢
      • 2020-10-25
      • 2020-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 2017-04-05
      • 2010-09-27
      • 2019-03-19
      相关资源
      最近更新 更多