Ich verzweifle bald
Testweise habe ich in den SubComponenten
Anchors beim TImage und
Caption beim TLabel in public verschoben.
Dennoch sind die weiterhin im Objectexplorer sichtbar und auch änderbar.
Wo ist denn mein Fehler im Code, damit die beiden Properties nicht mehr angezeigt werden?
Delphi-Quellcode:
unit ImageLabelTEST;
interface
uses
System.SysUtils, System.Classes,
Vcl.Controls,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.Graphics,
Vcl.Forms;
type
{ TMyImage }
TMyImage =
class(TImage)
private
protected
public
property Anchors;
published
end;
{ TMyLabel }
TMyLabel =
class(TLabel)
private
protected
public
property Caption;
published
end;
{ TIMageLabelTest }
TImageLabelTEST =
class(TCustomControl)
private
MyImage: TMyImage;
MyLabel: TMyLabel;
protected
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
procedure Resize;
override;
published
property MySubImage: TMyImage
read MyImage;
property MySubLabel: TMyLabel
read MyLabel;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
TRM', [TImageLabelTEST]);
end;
{ TMyImage }
{ TMyLabel }
{ TImageLabel }
constructor TImageLabelTEST.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.Parent := TWinControl(AOwner);
MyImage := TMyImage.Create(Self);
MyImage.SetSubComponent(True);
MyImage.Parent := Self;
MyLabel := TMyLabel.Create(Self);
MyLabel.SetSubComponent(True);
MyLabel.Parent := Self;
end;
procedure TImageLabelTEST.Resize;
begin
inherited;
end;
destructor TImageLabelTEST.Destroy;
begin
MyImage.Free;
MyLabel.Free;
inherited Destroy;
end;
end.
LG Mathias