Этот тип кнопки является ничьей по классу TThemedDropDownButton
, поэтому вы должны переопределить этот класс и метод TThemedDropDownButton.DrawBackground
.
Использование same unit of the previous answer добавить новый класс TThemedDropDownButtonEx
TThemedDropDownButtonEx= class(TThemedDropDownButton)
protected
procedure DrawBackground(var PaintRect: TRect); override;
end;
Затем реализовать метод DrawBackground как так
procedure TThemedDropDownButtonEx.DrawBackground(var PaintRect: TRect);
const
CheckedState: array[Boolean] of TThemedToolBar = (ttbButtonHot, ttbButtonCheckedHot);
var
LIndex : Integer;
begin
LIndex := SaveDC(Canvas.Handle);
try
if Enabled and not (ActionBar.DesignMode) then
begin
if (MouseInControl or IsChecked or DroppedDown) and
(Assigned(ActionClient) and not ActionClient.Separator) then
begin
StyleServices.DrawElement(Canvas.Handle, StyleServices.GetElementDetails(CheckedState[IsChecked or (FState = bsDown)]), PaintRect);
if IsChecked and not MouseInControl then
StyleServices.DrawElement(Canvas.Handle, StyleServices.GetElementDetails(ttbButtonPressed), PaintRect);
end
else
;
end
else
;
finally
RestoreDC(Canvas.Handle, LIndex);
end;
end;
и наконец изменить метод TPlatformVclStylesStyle.GetControlClass на этом пути
Изменить этот код
if AnItem.HasItems then
case GetActionControlStyle of
csStandard: Result := TStandardDropDownButton;
csXPStyle: Result := TXPStyleDropDownBtn;
else
Result := TThemedDropDownButton;
end
else
от этого
if AnItem.HasItems then
case GetActionControlStyle of
csStandard: Result := TStandardDropDownButton;
csXPStyle: Result := TXPStyleDropDownBtn;
else
Result := TThemedDropDownButtonEx;
end
else
прекрасно работает, спасибо за помощь! –
Ничего себе, король VCL Themes снова наносит удар! –