今天我的问题是关于在组件中创建一组PNG图像。我发现有一个按钮可以接受一个PNG图像作为字形,但它使用一个由图像的四个状态组成的PNG图像,如下所示:
我已经修改了组件,使用了四个不同的图像,每个图像都代表一个状态。因此,我的组件看起来像这样: ...
public
FPngImgEnabled: TPngImage;
FPngImgDisabled: TPngImage;
FPngImgDown: TPngImage;
FPngImgOver: TPngImage;
FDown: Boolean;
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
procedure Paint; override;
published
property PngImgEnabled: TPngImage read FPngImgEnabled write SetPngImgEnabled;
property PngImgDisabled: TPngImage read FPngImgDisabled write SetPngImgDisabled;
property PngImgDown: TPngImage read FPngImgDown write SetPngImgDown;
property PngImgOver: TPngImage read FPngImgOver write SetPngImgOver;
...
这是我有一个包含四个PNG图像和四个SetPng...过程的组件的方式。我想知道是否有一种方法可以使用包含这四个PNG图像的集合,类似于“TPNGImagesList”的东西,将图像集中在一个地方。
TImageList
有什么问题吗? - fantaghiroccoTImageState = (isEnabled, isDisabled, isDown, isOver);
,然后使用TObjectDictionary<TImageState, TPngImage>
。奖励是字典可以拥有图像对象并自行释放它们。 - J...