Переглянути джерело

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 тижнів тому
батько
коміт
aafda23ae5
2 змінених файлів з 2 додано та 6 видалено
  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);
 begin
   inherited;
-  ControlStyle := ControlStyle + [csReplicatable] - [csClickEvents];
+  ControlStyle := ControlStyle + [csParentBackground, csReplicatable] - [csClickEvents];
   { Using a fixed focus border width/height to avoid design problems between systems }
   FFocusBorderWidthHeight := 2;
   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
     FControl.SetBounds(FControl.Left, FControl.Top, Bitmap.Width + AutoSizeExtraWidth,
       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;
 end;
 
@@ -318,7 +314,7 @@ end;
 constructor TBitmapImage.Create(AOwner: TComponent);
 begin
   inherited;
-  ControlStyle := ControlStyle + [csReplicatable];
+  ControlStyle := ControlStyle + [csParentBackground, csReplicatable];
   FImpl.Init(Self);
   FImpl.BackColor := clBtnFace;
   Width := 105;