Setting Color of a Panel inside a TabSheet does nothing
Original Reporter info from Mantis: PascalR @PascalRiekenberg
-
Reporter name: Pascal Riekenberg
Original Reporter info from Mantis: PascalR @PascalRiekenberg
- Reporter name: Pascal Riekenberg
Description:
If you place a TPanel on a TTabSheet and set it's Color by code, it does not update.
If you set ParentColor to false before setting Color it does update.
As FParentColor is set to false in SetColor, we also have to perform CM_PARENTCOLORCHANGED (like done in SetParentColor):
procedure TControl.SetColor(Value: TColor);
begin
if FColor <> Value then
begin
FColor := Value;
FParentColor := False;
if Assigned(FParent) and not (csReading in ComponentState) then // new
Perform(CM_PARENTCOLORCHANGED, 0, 0); // new
Perform(CM_COLORCHANGED, 0, 0);
Invalidate;
end;
end;
This change fixes the problem!
Steps to reproduce:
See sample attached