FranjoZG,
nimalo me ne cudi sto si zaglavio s ovim; toliko je toga promenjeno u novijim Delphi-jima da vise covek nije pametan. Kod koji si postavio gore (uz neke izmene doduse) bi radio glat na (recimo) D7.
Posto me je zaintrigiralo zasto gornji kod ne radi, odvojio sam malo vremena i produvao zavrzlamu (komponenti su moja strast

). U prilogu je kod koji radi, uglavio sam i TImage i tvoju klasu TMyPicture. Kljuc je u pozivanju (nove?) metode SetSubComponent(IsSubComponent: boolean), i to svuda gde treba.
Kad iskompajliras i postavis slike u komponent (postavljen na formi), pogledaj prikaz 'View Form As Text', i tek ces onda videti kakav je to pi*vajz. Ali u ObjectInspector-u to izgleda sve kako treba.
Sledi kod:
Code:
unit MyGroupButton;
interface
uses
System.SysUtils, System.Classes, Vcl.Controls, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Graphics;
type
tMyPicture = class(TComponent) // zasto TComponent? zbog SetSubComponent()
private
fPicture: TImage;
public
constructor Create(aOwner: TComponent); override;
destructor Destroy; override;
published
property Picture: TImage read fPicture write fPicture;
end;
tMyGroupButton = class(TPanel)
private
fPicture: TMyPicture;
fPicture1: TImage;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Picture: tMyPicture read fPicture write fPicture;
property Picture1: TImage read fPicture1 write fPicture1;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyControls', [tMyGroupButton]);
end;
constructor tMyGroupButton.Create(AOwner: TComponent);
begin
inherited;
fPicture := tMyPicture.Create(self);
fPicture.SetSubComponent(true);
fPicture1 := TImage.Create(self);
fPicture1.SetSubComponent(true);
fPicture1.Parent := self;
fPicture1.Left := 20;
fPicture1.Top := 0;
fPicture1.Height := 24;
fPicture1.Width := 24;
fPicture1.Transparent := true;
fPicture1.AutoSize := true;
fPicture1.Visible := true;
end;
destructor tMyGroupButton.Destroy;
begin
fPicture.Free;
fPicture1.Free;
inherited;
end;
{ tMyPicture }
constructor tMyPicture.Create(aOwner: TComponent);
begin
inherited;
fPicture := TImage.Create(self);
fPicture.SetSubComponent(true);
fPicture.Parent := TWinControl(Owner); // ovo jeste malo nategnuto - typecast bez provere ...ali radi
fPicture.Left := 0;
fPicture.Top := 0;
fPicture.Width := 24;
fPicture.Height := 24;
fPicture.Transparent := true;
fPicture.AutoSize := true;
fPicture.Visible := true;
end;
destructor tMyPicture.Destroy;
begin
fPicture.Free;
inherited;
end;
end.
Pozz