Hello Fabio,
I think you should not paint the buttons yourself, but just add them to the panel and eventually assign the bitmap to the "Picture" property, that's it.
I took as example base the Delphi code of the demo in "Samples\AdvSmoothPanel\Demo2\UDemo.pas"
and tried a little and found this to be working:
var
I: Integer;
ARect : TRect;
PaccBrowser: TBitmap;
begin
...
AdvSmoothExpanderButtonPanel1.ButtonHeight := 32;
AdvSmoothExpanderButtonPanel1.ButtonWidth := 32;
PaccBrowser := TBitmap.Create;
PaccBrowser.Height := AdvSmoothExpanderButtonPanel1.ButtonHeight;
PaccBrowser.Width := AdvSmoothExpanderButtonPanel1.ButtonWidth;
ARect.Left := 0;
ARect.Top := 0;
ARect.Right := PaccBrowser.Width;
ARect.Bottom := PaccBrowser.Height;
...
try
for I := 0 to 5 do begin
with AdvSmoothExpanderButtonPanel1.Buttons.Add do begin
BevelColor := clBlack;
Randomize;
// Fill bitmap with random color - for testing
PaccBrowser.Canvas.Brush.Color := RGB(Random(255), Random(255), Random(255));
PaccBrowser.Canvas.FillRect(ARect);
// Assign the bitmap to the Picture -> done
Picture.Assign(PaccBrowser);
end;
end;
finally
PaccBrowser.Free;
end;
...
end;
Maybe this helps.
Regards,
Tobias