lcl, win32: create right color brush when color = clDefault

git-svn-id: trunk@28139 -
This commit is contained in:
paul 2010-11-08 01:32:05 +00:00
parent f77062d277
commit ef89f04c0a
2 changed files with 14 additions and 15 deletions

View File

@ -4621,13 +4621,17 @@ begin
if Value=Color then exit;
inherited SetColor(Value);
if BrushCreated then
FBrush.Color := Color;
if Color = clDefault then
FBrush.Color := TWSWinControlClass(WidgetSetClass).GetDefaultColor(Self)
else
FBrush.Color := Color;
if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
begin
TWSWinControlClass(WidgetSetClass).SetColor(Self);
Exclude(FWinControlFlags,wcfColorChanged);
end else
Include(FWinControlFlags,wcfColorChanged);
Exclude(FWinControlFlags, wcfColorChanged);
end
else
Include(FWinControlFlags, wcfColorChanged);
NotifyControls(CM_PARENTCOLORCHANGED);
end;
@ -4818,7 +4822,10 @@ procedure TWinControl.CreateBrush;
begin
if BrushCreated then exit;
FBrush := TBrush.Create;
FBrush.Color := Color;
if Color = clDefault then
FBrush.Color := TWSWinControlClass(WidgetSetClass).GetDefaultColor(Self)
else
FBrush.Color := Color;
// ToDo: ParentColor
end;

View File

@ -1358,17 +1358,9 @@ begin
Windows.SetTextColor(WindowDC, Windows.COLORREF(ColorToRGB(ChildWinControl.Font.Color)));
WindowColor := ChildWinControl.Brush.Color;
if WindowColor = clDefault then
begin
WindowColor := TWSWinControlClass(ChildWinControl.WidgetSetClass).GetDefaultColor(ChildWinControl);
Windows.SetBkColor(WindowDC, Windows.COLORREF(ColorToRGB(WindowColor)));
if IsSysColor(WindowColor) then
LMessage.Result := LResult(GetSysColorBrush(SysColorToSysColorIndex(WindowColor)));
end
else
begin
Windows.SetBkColor(WindowDC, Windows.COLORREF(ColorToRGB(WindowColor)));
LMessage.Result := LResult(ChildWinControl.Brush.Reference.Handle);
end;
Windows.SetBkColor(WindowDC, Windows.COLORREF(ColorToRGB(WindowColor)));
LMessage.Result := LResult(ChildWinControl.Brush.Reference.Handle);
//DebugLn(['WindowProc ', ChildWinControl.Name, ' Brush: ', LMessage.Result]);
// Override default handling
WinProcess := false;