jackjoker
asked on
ImageList
Is there a way to add all the images in the ImageList to a ListView as an Item?
ASKER
Let's say the ImageList as 5 images.
I want to add 5 items to the ListView, with the five images front the ImageList respectively.
I want to add 5 items to the ListView, with the five images front the ImageList respectively.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi jackjoker,
more specified
procedure TForm1.Button1Click(Sender : TObject);
var
Item : TListItem;
I : Integer;
begin
ListView1.LargeImages := ImageList1;
ListView1.ViewStyle := vsIcon;
for i := 0 to Imagelist1.Count - 1 do
begin
Item := ListView1.Items.Add;
Item.ImageIndex := I;
Item.Caption := 'Image '+IntToStr(I);
end;
end;
meikl
more specified
procedure TForm1.Button1Click(Sender
var
Item : TListItem;
I : Integer;
begin
ListView1.LargeImages := ImageList1;
ListView1.ViewStyle := vsIcon;
for i := 0 to Imagelist1.Count - 1 do
begin
Item := ListView1.Items.Add;
Item.ImageIndex := I;
Item.Caption := 'Image '+IntToStr(I);
end;
end;
meikl
Alex