我想获得 TGroupBox 标题的字体颜色,所以我可以将该颜色分配给 TLabel。
我想我需要使用GetThemeColor
,但我似乎无法弄清楚要使用哪些参数?
更新 - 这是我根据答案使用的代码:
function GetGroupBoxTextColor: TColor;
var
C: COLORREF;
ElementDetails: TThemedElementDetails;
begin
Result := clWindowText;
if ThemeServices.ThemesEnabled then
begin
ElementDetails := ThemeServices.GetElementDetails(tbGroupBoxNormal);
if GetThemeColor(ThemeServices.Theme[teButton], ElementDetails.Part, ElementDetails.State, TMT_TEXTCOLOR, C) = S_OK then
Result := C;
end;
end;