我有一个工具栏,我正在使用以下过程来更改其中一个工具按钮中矩形的颜色。ColorDepth
ImageList 的是cl24Bit
和DrawingStyle
是dsTransparent
。该程序工作正常。
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;
如果我将程序添加到存储库以供重用,它工作正常。但是,如果我从头开始一个新程序并使用完全相同的程序,我会得到一个白色按钮。我确保两个程序中图像列表和工具栏的属性相同。有效的程序是前段时间编写的。问题可能与 Windows 更新有关吗?我正在使用 Windows 10 和 Delphi 10。