Browse Source

Added parent background property

lainz 5 years ago
parent
commit
86721d0674
1 changed files with 14 additions and 1 deletions
  1. 14 1
      bcpanel.pas

+ 14 - 1
bcpanel.pas

@@ -95,6 +95,7 @@ type
     procedure DrawControl; override;
     procedure RenderControl; override;
   protected
+    procedure SetParentBackground(const AParentBackground: Boolean); override;
     property Background: TBCBackground read FBackground write SetBackground;
     property BevelInner: TBevelCut read FBevelInner write SetBevelInner;
     property BevelOuter: TBevelCut read FBevelOuter write SetBevelOuter;
@@ -150,6 +151,7 @@ type
     property DragMode;
     property Enabled;
     property FontEx;
+    property ParentBackground;
     property PopupMenu;
     property Rounding;
     property ShowHint;
@@ -227,6 +229,17 @@ begin
     FBGRA.NeedRender := True;
 end;
 
+procedure TCustomBCPanel.SetParentBackground(const AParentBackground: Boolean);
+begin
+  if ParentBackground=AParentBackground then
+    Exit;
+  if AParentBackground then
+    ControlStyle := ControlStyle - [csOpaque]
+  else
+    ControlStyle := ControlStyle + [csOpaque];
+  inherited;
+end;
+
 function TCustomBCPanel.GetStyleExtension: String;
 begin
   Result := 'bcpnl';
@@ -433,7 +446,7 @@ begin
     ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse,
       csClickEvents, csSetCaption, csDoubleClicks, csReplicatable{$IFDEF FPC},
       csNoFocus, csAutoSize0x0{$ENDIF}]
-      - [csOpaque]; // we need the default background
+      + [csOpaque]; // we need the default background
     //Self.DoubleBuffered := True;
     with GetControlClassDefaultSize do
       SetInitialBounds(0, 0, CX, CY);