The Delphi Bug List

Entry No.
512
VCL - Standard - StdCtrls - TLabel
TLabel does not show the correct background color after it is loaded if the color is clWindow
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
N/AN/AExistsExistsExistsExistsExistsExistsExistsExistsExistsExistsExistsExistsN/A
Description
Reported by Mike Lischke; checked by Reinier Sterkenburg
To reproduce:
Take any TForm, place a label on it, set its Color property to clWindow. Switch to "View as text" and switch back to "View as form". Now the label's color is clBtnFace (or whatever color the parent of the label has).
Solution / workaround
Explicitly set the label's Color to clWindow after creation.
User-contributed comments
AzzaAzza69
11 Oct 2001  08:48 AM GMT
The problem is due to the fact that the TLabel is inherited from the TControl that has the default for the Color property set to clWindow and hence is not streaming it away when writing the DFM:

controls.pas:
TControl = class(TComponent)
...
property Color: TColor read FColor write SetColor stored IsColorStored default clWindow;
...
Latest update of this entry: 2002-04-03

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.