procedure PaintCloseButton(
DC: HDC; Down, Hot: Boolean; R: TRect);
var
Button: TThemedWindow;
Details: TThemedElementDetails;
CR: TRect;
begin
if ThemeServices.ThemesEnabled
then
begin
Button := twCloseButtonNormal;
if Down
then
Button := twCloseButtonPushed
if Hot
then
Button := twCloseButtonHot;
Details := ThemeServices.GetElementDetails(Button);
CR := ThemeServices.ContentRect(0, Details, R);
R.Left := R.Left * 2 - CR.Left;
R.Top := R.Top * 2 - CR.Top;
R.Right := R.Right * 2 - CR.Right;
R.Bottom := R.Bottom * 2 - CR.Bottom;
CR := ThemeServices.ContentRect(0, Details, R);
ThemeServices.DrawElement(
DC, Details, R, @CR);
end;
end;