LCL/Win32: Fix disabled StaticText being drawn with opaque text background although Transparent is true.

git-svn-id: branches/fixes_2_0@63377 -
This commit is contained in:
mattias 2020-06-17 10:03:26 +00:00
parent 87a93ab40e
commit a2f205657f

View File

@ -1630,13 +1630,18 @@ begin
WM_PAINT:
begin
WindowInfo := GetWin32WindowInfo(Window);
if ThemeServices.ThemesEnabled and Assigned(WindowInfo) and (WindowInfo^.WinControl is TCustomStaticText)
and not TCustomStaticText(WindowInfo^.WinControl).Enabled then
// Workaround for disabled StaticText not being grayed at designtime
if ThemeServices.ThemesEnabled and Assigned(WindowInfo) and
(WindowInfo^.WinControl is TCustomStaticText)
and not TCustomStaticText(WindowInfo^.WinControl).Enabled then
begin
Result := WindowProc(Window, Msg, WParam, LParam);
StaticText := TCustomStaticText(WindowInfo^.WinControl);
if not (csDesigning in StaticText.ComponentState) then
exit;
DC := GetDC(Window);
SetBkColor(DC, GetSysColor(COLOR_BTNFACE));
SetBkMode(DC, TRANSPARENT);
SetTextColor(DC, GetSysColor(COLOR_GRAYTEXT));
SelectObject(DC, StaticText.Font.Reference.Handle);
Flags := 0;