If you want draw the background of the buttons you must use the StyleServices.DrawElement
method passing the proper TThemedButton
part.
Try this sample
uses
Vcl.Styles,
Vcl.Themes;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
Details : TThemedElementDetails;
begin
Details := StyleServices.GetElementDetails(tbPushButtonPressed);
StyleServices.DrawElement(PaintBox1.Canvas.Handle, Details, PaintBox1.ClientRect);
Details := StyleServices.GetElementDetails(tbPushButtonNormal);
StyleServices.DrawElement(PaintBox2.Canvas.Handle, Details, PaintBox2.ClientRect);
end;
If you want draw the background without corners, you can adjust the bounds of the TRect
like so
Details : TThemedElementDetails;
LRect : TRect;
begin
LRect:=PaintBox1.ClientRect;
LRect.Inflate(3,3);
Details := StyleServices.GetElementDetails(tbPushButtonPressed);
StyleServices.DrawElement(PaintBox1.Canvas.Handle, Details, LRect);
LRect:=PaintBox2.ClientRect;
LRect.Inflate(3,3);
Details := StyleServices.GetElementDetails(tbPushButtonNormal);
StyleServices.DrawElement(PaintBox2.Canvas.Handle, Details, LRect);
end;