hi I am trying to convert a bitmap to a icon, with the image list, it does save tho the transparent color does not, I tested in delphi 7 and it works fine any ideas what's wrong here my code.
procedure Tfrmmain.cmdConvertClick(Sender: TObject); var ico : TIcon; begin ico := CreateIconFromBitmap(Image1.Picture.Bitmap,clFuchsia); ico.SaveToFile('c:\out\new.ico'); end;
function CreateIconFromBitmap(Bitmap: TBitmap; TransparentColor: TColor): TIcon; begin with TImageList.CreateSize(Bitmap.Width, Bitmap.Height) do begin try AllocBy := 1; AddMasked(Bitmap, TransparentColor); Result := TIcon.Create; try GetIcon(0, Result); except Result.Free; raise; end; finally Free; end; end; end; |
The bitmap is also just a 32x32x16 color