Hello, the code below is how I load and convert PNG files into BMPs, add them to a TImageList, and then add them to a TListView. The problem I'm having is that I cannot get the little bugger to scale to 96x96; other than that the code works. I would imagine that setting the timage's stretch property to true ought to scale the image to 96x96, but that was not the case.
lsTextures: TListView; imgTextures: TImageList; procedure TForm1.MenuItem15Click(Sender: TObject); var bmp: TBitmap; img: TImage; itm: TListItem; begin bmp := TBitmap.Create; img := TImage.Create(nil); try lsTextures.BeginUpdate; img.Stretch := true; img.Width := 96; img.Height := 96; bmp.Width := 96; bmp.Height := 96; img.Picture.LoadFromFile('screen.png'); itm := lsTextures.Items.Add; bmp.Assign(img.Picture.Bitmap); imgTextures.AddMasked(bmp,clFuchsia); itm.Caption := 'New Image'; itm.ImageIndex := imgTextures.Count-1; finally bmp.Free; lsTextures.EndUpdate; end; end;
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus