Thema: Delphi TImage als Parent

Einzelnen Beitrag anzeigen

m.r.m.
(Gast)

n/a Beiträge
 
#12

Re: TImage als Parent

  Alt 30. Sep 2008, 15:42
Zitat von uligerhardt:
Also Aggregation, etwa so:
Delphi-Quellcode:
  TImagePanel = class(TCustomPanel)
  private
    FImage: TImage;
  public
    constructor Create(AOwner: TComponent); override;
    property Image: TImage read FImage;
  end;

constructor TImagePanel.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  AutoSize := True;
  FImage := TImage.Create(Self);
  FImage.Parent := Self;
end;
Das funktioniert mit Erzeugen zur Laufzeit. Für Designzeit-Unterstützung braucht's wohl noch etwas Feinschliff.
Das ist bei mir aber nicht transparent.
  Mit Zitat antworten Zitat