I have a tool bar and I am using the following procedure to change the color of a rectangle in one of the tool buttons. The ColorDepth
of the ImageList is cl24Bit
and the DrawingStyle
is dsTransparent
. The procedure works fine.
procedure TANewMain.BtReplaceHighOnClick(Sender: TObject);
var
ABitmap: TBitmap;
ARect: TRect;
begin
ABitmap := TBitmap.Create;
try
ImgList.GetBitmap(1, ABitmap);
ABitmap.Canvas.Brush.Color := ColorToRGB(clRed); // S04
ABitmap.Canvas.Pen.Color := ColorToRGB(clBlue);
ARect := Rect(5, 1, 11, 15);
ABitmap.Canvas.Rectangle(ARect);
ImgList.ReplaceMasked(1, ABitmap, clWhite);
finally
ABitmap.Free;
end;
end;
If I add the program to the repository for reuse it works fine. However, if I start a new program from scratch and use the exact same procedure, I get a white button. I made sure that the properties for the image list and the tool bar are the same in both programs. The program that works was written some time ago. Could the problem have anything to do with Windows updates? I am using Windows 10 and Delphi 10.