Pārlūkot izejas kodu

Stop TBitmapImageImplementation.BitmapChanged from removing csParentBackground and setting csOpaque.

For UpdatePanelCloseBitBtn it doesn't work since FControl.Width/Height is 0 when this function is called, which it is only once. So UpdatePanelCloseBitBtn always has csOpaque set even though it isn't opaque.

When both the whatsnew and purchase banners are visible (which have different colors), and the user closes the top banner, this makes the color of the close button become wrong. Invalidating doesn't work since Delphi checks for csParentBackground then.

Also bitmaps can be transparent so it makes no sense anyway?
Martijn Laan 3 nedēļas atpakaļ
vecāks
revīzija
aafda23ae5
2 mainītis faili ar 2 papildinājumiem un 6 dzēšanām
  1. 1 1
      Components/BitmapButton.pas
  2. 1 5
      Components/BitmapImage.pas

+ 1 - 1
Components/BitmapButton.pas

@@ -79,7 +79,7 @@ end;
 constructor TBitmapButton.Create(AOwner: TComponent);
 constructor TBitmapButton.Create(AOwner: TComponent);
 begin
 begin
   inherited;
   inherited;
-  ControlStyle := ControlStyle + [csReplicatable] - [csClickEvents];
+  ControlStyle := ControlStyle + [csParentBackground, csReplicatable] - [csClickEvents];
   { Using a fixed focus border width/height to avoid design problems between systems }
   { Using a fixed focus border width/height to avoid design problems between systems }
   FFocusBorderWidthHeight := 2;
   FFocusBorderWidthHeight := 2;
   const DoubleFBWH = 2*FFocusBorderWidthHeight;
   const DoubleFBWH = 2*FFocusBorderWidthHeight;

+ 1 - 5
Components/BitmapImage.pas

@@ -179,10 +179,6 @@ begin
   if AutoSize and (Bitmap.Width > 0) and (Bitmap.Height > 0) then
   if AutoSize and (Bitmap.Width > 0) and (Bitmap.Height > 0) then
     FControl.SetBounds(FControl.Left, FControl.Top, Bitmap.Width + AutoSizeExtraWidth,
     FControl.SetBounds(FControl.Left, FControl.Top, Bitmap.Width + AutoSizeExtraWidth,
       Bitmap.Height + AutoSizeExtraHeight);
       Bitmap.Height + AutoSizeExtraHeight);
-  if (Bitmap.Width >= FControl.Width) and (Bitmap.Height >= FControl.Height) then
-    FControl.ControlStyle := FControl.ControlStyle + [csOpaque] - [csParentBackground]
-  else
-    FControl.ControlStyle := FControl.ControlStyle - [csOpaque] + [csParentBackground];
   FControl.Invalidate;
   FControl.Invalidate;
 end;
 end;
 
 
@@ -318,7 +314,7 @@ end;
 constructor TBitmapImage.Create(AOwner: TComponent);
 constructor TBitmapImage.Create(AOwner: TComponent);
 begin
 begin
   inherited;
   inherited;
-  ControlStyle := ControlStyle + [csReplicatable];
+  ControlStyle := ControlStyle + [csParentBackground, csReplicatable];
   FImpl.Init(Self);
   FImpl.Init(Self);
   FImpl.BackColor := clBtnFace;
   FImpl.BackColor := clBtnFace;
   Width := 105;
   Width := 105;