Re: Possible TImageList bug in D7? or..?



You're right !

Uses this function :

function LoadFile(const Img: TImageList; const FileName: String): Boolean;
var
bmp, bmp2 : TBitmap;
begin
Result := False;

bmp := TBitmap.Create;
bmp2 := TBitmap.Create;
try
// Load file
if FileExists(FileName) then bmp.LoadFromFile(FileName)
else exit;

// Modify size
bmp2.Height := Img.Height;
bmp2.Width := Img.Width;
bmp2.Canvas.StretchDraw(Rect(0, 0, Img.Width, Img.Height), bmp);

// Add the file in TImageList
Img.Add(bmp2, nil);

Result := True;
finally
bmp.Free;
bmp2.Free;
end;
end;


.