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
if ParentBackground=AParentBackground then
Exit;
if AParentBackground then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];
inherited;
UpdateParentColorChange;
end;
procedure TCustomPanel.SetShowAccelChar(const Value: Boolean);
@ -220,7 +217,7 @@ end;
procedure TCustomPanel.UpdateParentColorChange;
begin
if ParentColor then
if ParentColor or ParentBackground then
ControlStyle := ControlStyle - [csOpaque]
else
ControlStyle := ControlStyle + [csOpaque];