Browse Source

Bug fix: When system theme changed path labels lost their background color

(cherry picked from commit 4dc8b78a55df9845a549c6005d3e3f3d069b601a)

Source commit: 265f7bd9c4dd5ab2207e15746ad88618d811f138
Martin Prikryl 7 years ago
parent
commit
e9db113c64
1 changed files with 16 additions and 0 deletions
  1. 16 0
      source/packages/my/PathLabel.pas

+ 16 - 0
source/packages/my/PathLabel.pas

@@ -64,6 +64,7 @@ type
     procedure DoMaskClick;
     procedure DblClick; override;
     procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override;
+    procedure CMStyleChanged(var Message: TMessage); message CM_STYLECHANGED;
 
   public
     constructor Create(AnOwner: TComponent); override;
@@ -921,4 +922,19 @@ begin
   inherited;
 end;
 
+procedure TCustomPathLabel.CMStyleChanged(var Message: TMessage);
+var
+  WasNotTransparent: Boolean;
+begin
+  // WORKAROUND for what seems like a bug in TCustomLabel.CMStyleChanged that unconditionally sets Transparent := True,
+  // when styling is enabled
+  WasNotTransparent := not Transparent;
+  inherited;
+  if WasNotTransparent then
+  begin
+    Transparent := False;
+    Invalidate;
+  end;
+end;
+
 end.