Du kannst über einen umweg die PNG's mit
GDI+ laden und zu TBitmap umwandeln
ohne den Alphachannel zu verlieren.
Schau mal mein Sample GDIClock_v14 an.
Delphi-Quellcode:
hbmReturn := LoadSourceImage('xxx.png');
if hbmReturn <> 0 then
begin
xxxImg := TBitmap.Create;
xxxImg.Handle := hbmReturn;
end;
Delphi-Quellcode:
// This function is used to load PNG file which has alpha channel and
// returns the handle to bitmap.
// The rgbReserved element of bitmap gets the data of alpha channel.
function LoadSourceImage(ImgFile : WideString) : HBITMAP;
var
img: cardinal;
hbmReturn: HBITMAP;
format : integer;
begin
Result := 0;
if not GDIReady
then
exit;
if not FileExists(ImgFile)
then
exit;
GdipLoadImageFromFile(PWideChar(ImgFile), img);
if img <> 0
then
begin
GdipGetImagePixelFormat(img, format);
if format = PixelFormat32bppARGB
then // Accept files with alpha channel
begin
GdipCreateHBITMAPFromBitmap(pointer(img), hbmReturn, $000000);
if hbmReturn <> 0
then
Result := hbmReturn;
end;
GdipDisposeImage(img);
end;
end;
gruss