lcl: reset Brush.Color and Style on setting Bitmap and vice versa, perform only 1 Change event after Assign(), based on patch of David Jenkins, issue #0021762

git-svn-id: trunk@36807 -
This commit is contained in:
paul 2012-04-16 06:03:24 +00:00
parent a34725fc50
commit 2286675357

View File

@ -57,6 +57,8 @@ begin
if Style <> Value then
begin
FreeReference;
// reset bitmap
FBitmap := nil;
inherited SetStyle(Value);
Changed;
end;
@ -75,6 +77,10 @@ begin
begin
FreeReference;
FBitmap := Value;
// reset style and color
inherited SetStyle(bsSolid);
FColor := clWhite;
inherited SetFPColor(TColorToFPColor(FColor));
Changed;
end;
end;
@ -121,9 +127,11 @@ procedure TBrush.Assign(Source: TPersistent);
begin
if Source is TBrush then
begin
Bitmap := TBrush(Source).Bitmap;
SetColor(TBrush(Source).Color, TFPCanvasHelper(Source).FPColor);
Style := TBrush(Source).Style;
FColor := TBrush(Source).Color;
inherited SetFPColor(TFPCanvasHelper(Source).FPColor);
inherited SetStyle(TBrush(Source).Style);
FBitmap := TBrush(Source).Bitmap;
Changed;
end
else
inherited Assign(Source);
@ -290,6 +298,8 @@ procedure TBrush.SetColor(const NewColor: TColor; const NewFPColor: TFPColor);
begin
if (NewColor = Color) and (NewFPColor = FPColor) then Exit;
FreeReference;
// reset bitmap
FBitmap := nil;
FColor := NewColor;
inherited SetFPColor(NewFPColor);
Changed;