From a2f205657fee1ca6f4eed7c07c4b768cf7ecaef0 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 17 Jun 2020 10:03:26 +0000 Subject: [PATCH] LCL/Win32: Fix disabled StaticText being drawn with opaque text background although Transparent is true. git-svn-id: branches/fixes_2_0@63377 - --- lcl/interfaces/win32/win32wsstdctrls.pp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index fadb2ecaa3..b2dc5c9aee 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -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;