TPanel: fix csOpaque style inconsistency (it depended on the order of ParentColor/ParentBackground change)

This commit is contained in:
Ondrej Pokorny 2022-12-14 21:42:43 +01:00
parent 7d00a524a4
commit 96291eb9a5

View File

@ -77,11 +77,8 @@ procedure TCustomPanel.SetParentBackground(const AParentBackground: Boolean);
begin begin
if ParentBackground=AParentBackground then if ParentBackground=AParentBackground then
Exit; Exit;
if AParentBackground then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
inherited; inherited;
UpdateParentColorChange;
end; end;
procedure TCustomPanel.SetShowAccelChar(const Value: Boolean); procedure TCustomPanel.SetShowAccelChar(const Value: Boolean);
@ -220,7 +217,7 @@ end;
procedure TCustomPanel.UpdateParentColorChange; procedure TCustomPanel.UpdateParentColorChange;
begin begin
if ParentColor then if ParentColor or ParentBackground then
ControlStyle := ControlStyle - [csOpaque] ControlStyle := ControlStyle - [csOpaque]
else else
ControlStyle := ControlStyle + [csOpaque]; ControlStyle := ControlStyle + [csOpaque];