PNGファイルをTPngImageListに追加しようとしています(D7のPngComponentsはhttp://code.google.com/p/cubicexplorer/downloads/listから取得しました)。
type
TImgListCrack = class(TPngImageList);
function LoadPngIconEx(ImageList: TPngImageList; const fn: string): boolean;
var
Icon: HICON;
AImage: TPngObject;
begin
with ImageList do
begin
BeginUpdate;
try
AImage:= TPngObject.Create;
AImage.LoadFromFile(fn);
Icon:= TImgListCrack(ImageList).PngToIcon(AImage);
ImageList_AddIcon(Handle, Icon);
DestroyIcon(Icon);
FreeAndNil(AImage);
Result:= true;
finally
EndUpdate;
end;
end;
end;
結果: アイコンは追加されず、イメージリストはまだ空です。どうしたらいいの?