Just enable the alphachannel and set the transparent color:
procedure TForm2.ShowExeIcon(const AFile: string;
const AIndex, AIconSize: Integer; AImage: TImageEnView);
var
hIcon: THandle;
nIconId: DWORD;
Icon: TIcon;
iRGB: TRGB;
begin
if PrivateExtractIcons(PChar(AFile), AIndex, AIconSize, AIconSize, @hIcon,
@nIconId, 1, LR_LOADFROMFILE) <> 0 then
begin
try
Icon := TIcon.Create;
try
Icon.Handle := hIcon;
AImage.Clear;
AImage.Bitmap.Assign(Icon);
AImage.EnableAlphaChannel := True;
iRGB := AImage.IEBitmap.Pixels[0, AImage.IEBitmap.Height - 1];
AImage.Proc.SetTransparentColors(iRGB, iRGB, 0);
AImage.IO.Params.BitsPerSample := 8;
AImage.IO.Params.SamplesPerPixel := 4;
AImage.Update;
finally
Icon.Free;
end;
finally
DestroyIcon(hIcon);
end;
end
else
begin
//
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development