From cced0352b30d205e6df0921ec9fb7b3b2081a75d Mon Sep 17 00:00:00 2001 From: micha Date: Tue, 29 Nov 2005 21:23:28 +0000 Subject: [PATCH] fix ControlStyle csOpaque for TCustomLabel (not opaque when transparent) git-svn-id: trunk@8240 - --- lcl/include/customlabel.inc | 14 ++++++++++++-- lcl/stdctrls.pp | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lcl/include/customlabel.inc b/lcl/include/customlabel.inc index 137ec7710a..55b5c83517 100644 --- a/lcl/include/customlabel.inc +++ b/lcl/include/customlabel.inc @@ -152,8 +152,7 @@ constructor TCustomLabel.Create(TheOwner: TComponent); begin inherited Create(TheOwner); Font.OnChange := @FontChange; - ControlStyle := [csSetCaption, csOpaque, csClickEvents, csDoubleClicks, - csReplicatable]; + ControlStyle := [csSetCaption, csClickEvents, csDoubleClicks, csReplicatable]; Width := 65; Height := 17; FShowAccelChar := True; @@ -166,6 +165,17 @@ begin Result := Color = clNone; end; +procedure TCustomLabel.SetColor(NewColor: TColor); +begin + inherited; + + // if color = clnone then transparent, so not opaque + if NewColor = clNone then + ControlStyle := ControlStyle - [csOpaque] + else + ControlStyle := ControlStyle + [csOpaque]; +end; + {------------------------------------------------------------------------------ Method: TCustomLabel.SetLayout Params: None diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index e3923c0ac9..5b1620e9be 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -1140,6 +1140,7 @@ type function GetAlignment: TAlignment; function GetTransparent: boolean; procedure SetAlignment(Value: TAlignment); + procedure SetColor(NewColor: TColor); override; procedure SetFocusControl(Value: TWinControl); procedure SetLayout(Value: TTextLayout); procedure SetShowAccelChar(Value: Boolean);