Delphi 在firemonkey中创建复合控件

Delphi 在firemonkey中创建复合控件,delphi,firemonkey,Delphi,Firemonkey,德尔福XE-6 我正在尝试创建自己的自定义Firemonkey控件,该控件派生自TGroupBox,我在groupbox上创建了TGridPanelLayout控件 constructor TMyRadioGroup.Create(AOwner: TComponent); begin inherited Create(AOwner); FLayout:= TGridPanelLayout.Create(self); FLayout.Parent:= self; end; 如何防止用

德尔福XE-6

我正在尝试创建自己的自定义Firemonkey控件,该控件派生自TGroupBox,我在groupbox上创建了TGridPanelLayout控件

constructor TMyRadioGroup.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FLayout:= TGridPanelLayout.Create(self);
  FLayout.Parent:= self;
end;

如何防止用户选择和/或删除TGridPanelLayout控件?在设计时,我只希望我的父控件(从TGroupbox派生)能够从表单中选择和删除。

对于设计时不希望选择的每个子控件,需要将
存储的
属性设置为
false
。例如,下面的代码创建了一个带有两个子控件的面板,一个
TEdit
和一个
TButton

unit PanelCombo;

interface

uses
  System.SysUtils, System.Classes, FMX.Types, FMX.Controls,
  FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit;

type
  TPanelCombo = class(TPanel)
  private
    { Private declarations }
    edit1: TEdit;
    button1: TButton;
  protected
    { Protected declarations }
  public
    { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TPanelCombo]);
end;

constructor TPanelCombo.Create(AOwner: TComponent);
begin
  inherited;
  edit1:= TEdit.create(self);
  edit1.parent:= self;
  edit1.align:= TAlignLayout.Top;
  edit1.stored:= false;

  button1:= TButton.create(self);
  button1.parent:= self;
  button1.align:= TAlignLayout.bottom;
  button1.stored:= false;
end;

destructor TPanelCombo.Destroy;
begin
  inherited;
  edit1.Free;
  button1.Free;
end;

end.

啊-谢谢你!