Hi all,

I'm experiencing performance problems when adding a large set of
bitmaps to an ImageList. The bitmaps are 55x55 pixels in size, which
matches the ImageList's ImageSize property. Adding approx. 5000 bitmaps
takes about 1,5 minutes. The bitmaps are generated from scratch,
resized and other things much faster than that (in just a few seconds)
so why should adding them to an imagelist be so slow?

The imagelist is also the source for a ListView, which displays the
results. I've tried adding the bitmaps to the ImageList via Add(),
AddRange() and using the async. virtual mode. The latter sounded
promising, but didn't help.

Any ideas, hints?

Cheers,
Johan Sj=F6str=F6m
MSc, MCAD, MCTS, MCITP

Re: ImageList performance problem by Jared

Jared
Mon Jan 15 13:56:41 CST 2007

could try to disconnect listview if connected and also look at lowering
bitdepth wich is just a property of the image list



Re: ImageList performance problem by daddynahoj

daddynahoj
Mon Jan 15 14:29:19 CST 2007

Thanks Jared, I've tried that with no great impact on performance. :(

Cheers,
Johan Sj=F6str=F6m
MSc, MCAD, MCTS, MCITP

Jared (Home) skrev:

> could try to disconnect listview if connected and also look at lowering
> bitdepth wich is just a property of the image list


Re: ImageList performance problem by daddynahoj

daddynahoj
Mon Jan 15 14:59:24 CST 2007

Actually, I tried disconnecting the ListView from the ImageList by
setting the ListView's LargeImageList property to null, but to improve
performance I had to remove the connection from the designer as well.
Now the adding of images is very fast, but as soon as I connect the
ListView the computer really goes to work..

This example proves my point. It's a simple form with a Button,
ImageList and ListView. It's Part 2 that locks up the CPU for a good
minute or so.



private void button1_Click(object sender, EventArgs e)
{

// Part 1, add images to imagelist
imageList1.Images.Clear();
label1.Text =3D "Adding..";
label1.Update();
for (int i =3D 0; i < 5000; i++)
{
imageList1.Images.Add(new Bitmap(1, 1));
}

// Part 2, connect listview to imagelist
label1.Text =3D "Connecting listview..";
label1.Update();
listView1.LargeImageList =3D imageList1;
label1.Text =3D "Finished.";
label1.Update();

}

Cheers,
Johan Sj=F6str=F6m
MSc, MCAD, MCTS, MCITP


Re: ImageList performance problem by daddynahoj

daddynahoj
Tue Jan 16 04:30:22 CST 2007

Looks like I'm forced to go with the really fast DataGridView instead.
Adding bitmaps to an ImageColumn and binding it that way only takes a
second or so.

Guess ListView + ImageList isn't meant for heavy duty use..

Cheers
Johan Sj=F6str=F6m
MSc, MCAD, MCTS, MCITP