You should make the image a subcomponent of TMyPanel: SetSubComponent
Update: Here is an example
unit MyComponent;
interface
uses
System.Classes,
VCL.Controls,
VCL.Forms,
VCL.ExtCtrls;
type
TMyPanel = class(TScrollBox)
private
FImage: TImage;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Image: TImage read FImage;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Standard', [TMyPanel]);
end;
constructor TMyPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FImage := TImage.Create(Self);
FImage.SetSubComponent(true);
FImage.Align := alClient;
FImage.Parent := Self;
end;
destructor TMyPanel.Destroy;
begin
inherited;
end;
end.