Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

ImageList performance problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Johan Sjöström - 15 Jan 2007 17:26 GMT
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öström
MSc, MCAD, MCTS, MCITP
Jared (Home) - 15 Jan 2007 19:56 GMT
could try to disconnect listview if connected and also look at lowering
bitdepth wich is just a property of the image list
Johan Sjöström - 15 Jan 2007 20:29 GMT
Thanks Jared, I've tried that with no great impact on performance. :(

Cheers,
Johan Sj?str?m
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
Johan Sjöström - 15 Jan 2007 20:59 GMT
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 = "Adding..";
           label1.Update();
           for (int i = 0; i < 5000; i++)
           {
               imageList1.Images.Add(new Bitmap(1, 1));
           }

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

       }

Cheers,
Johan Sjöström
MSc, MCAD, MCTS, MCITP
Johan Sjöström - 16 Jan 2007 10:30 GMT
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öström
MSc, MCAD, MCTS, MCITP

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.