如何创建组 属性

How to Create Group Property

我想创建一组属性(可扩展属性)我定义了一个记录类型并将我的属性的类型设置为一条记录。但是 属性 没有出现在对象检查器中,但是在 运行 我可以访问那个 属性.

  type
  GageProperty = Record
    MaxValue:Real;
    Color1:TColor;
    Color2:TColor;
    DividerLength:Integer;
    DownLimit:Real;
    FloatingPoint:Integer;
    Frame:Boolean;
    GageFont:TFont;
    GradiantStyle:GradStyle;
    Height:Integer;
    Width:Integer;
    Left:Integer;
    MinValue:Real;
    NeedleColor:Tcolor;
    Sector1Color:TColor;
    Sector2Color:TColor;
    Sector3Color:TColor;
    SignalFont:TFont;
    SignalNmae:String;
    Step:Integer;
    SubStep:Integer;
    Thickness:Integer;
    Top:Integer;
    UpLimit:Real;
    ValueUnit:String;
  End;
  TGasTurbine = class(TPanel)
  private
    { Private declarations }
    FGageProp:GageProperty;
    Procedure SetGageProp(Const Value:GageProperty);
  published
    { Published declarations }
    Property GageProp: GageProperty Read FGageProp Write SetGageProp;

我该怎么办? 请帮助我

对于可流化并在设计器中设置的结构化类型,类型必须从 TPersistent:

派生
type
  TGage = class(TPersistent)
  public
    MaxValue: Real;
    Color1: TColor;
    Color2: TColor;
    procedure Assign(Source: TPersistent); override;
  end;

  TGasTurbine = class(TPanel)
  private
    FGage: TGage;
    procedure SetGage(Value: TGage);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property Gage: TGage read FGage write SetGage;
  end;    

procedure TGage.Assign(Source: TPersistent);
begin
  if Source is TGage then
  begin
    MaxValue := TGage(Source).MaxValue;
    Color1 := TGage(Source).Color1;
    Color2 := TGage(Source).Color2;
  end
  else
    inherited Assign(Source);
end;

constructor TGasTurbine.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FGage := TGage.Create;
end;

destructor TGasTurbine.Destroy;
begin
  FGage.Free;
  inherited Destroy;
end;

procedure TGasTurbine.SetGage(Value: TGage);
begin
  FGage.Assign(Value);
end;