Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TAdvSmoothListBox
How to programmatically load an image from an imagelist
How to programmatically load an image from an imagelist
You can load the images with the code below:
For .BMP files
var I: Integer; bmp: TBitmap; begin bmp := TBitmap.Create; for I := 0 to ImageList1.Count - 1 do begin ImageList1.GetBitmap(I, bmp); AdvSmoothListBox1.Items.Add.Image.Assign(bmp); end; bmp.Free;
For .ICO files
var I: Integer; ico: TIcon; ms: TMemoryStream; begin ico := TIcon.Create; for I := 0 to ImageList1.Count - 1 do begin ImageList1.GetIcon(I, ico); ms := TMemoryStream.Create; ico.SaveToStream(ms); AdvSmoothListBox1.Items.Add.Image.LoadFromStream(ms); ms.Free; end; ico.Free;