Hallo Tom,
versuche es einmal so:
Delphi-Quellcode:
type
TmyPanel = class (TCustomControl)
private
FPicture : TPicture;
procedure PictureChanged (Sender: TObject);
procedure SetPicture (aValue: TPicture);
public
constructor Create (aOwner: TComponent); override;
destructor Destroy; override;
published
property Picture: TPicture read FPicture write SetPicture;
end;
constructor TmyPanel.Create (aOwner: TComponent);
begin
inherited;
FPicture := TPicture.Create;
FPicture.OnChange := PictureChanged;
end;
destructor TmyPanel.Destroy;
begin
FPicture.Free;
inherited;
end;
procedure TmyPanel.PictureChanged (Sender: TObject);
begin
Invalidate;
end;
procedure TmyPanel.SetPicture (aValue: TPicture);
begin
FPicture.Assign (aValue); // KEINE Zuweisung, sondern Assign!
end;
Der Code ist nicht getestet, aber so ungefähr sollte es funktionieren.
Gruß Hawkeye