I have approximately 800 icons I use in my app. I am trying to consolidate them in to a single dll so that I do not have slightly different versions of the icon all over the place.
I tried several things, none of which are working out well for me.
Originally, I had several forms (for categorization purposes only) with a control array of images. Each icon (256 color 16 x 16) was loaded in to an image box. I gave each image a TAG and used that to get the icon I wanted to display. This approach worked well until I noticed that my app was using approximately 4,000 GDI objects after initially loading. Eventually ran in to the 10,000 limit and kaboom!
I also tried putting the icons in to a resource file. The problem I had with this approach is that even though I used 16x16 icons, they were coming out stretched to 32x32.
I then tried using an Image list. I'm actually using multiple image lists so that I can categorize the icons. This is a little bit of an improvement, but my app is still taking up approximately 2,000 GDI objects on startup. It's also taking a lot longer to load the app.
When my app loads, I dynamically create a "ribbon bar" that has approximately 100 icons on buttons. Unfortunately, I've already distributed my app, so I would prefer to modify this dll without changing too much functionality. Currently, I pass in a string that represents the Icon I want and the dll returns an IPictureDisp for the image.
Has anyone else done something similar? What are the preferred methods here?
-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
I tried several things, none of which are working out well for me.
Originally, I had several forms (for categorization purposes only) with a control array of images. Each icon (256 color 16 x 16) was loaded in to an image box. I gave each image a TAG and used that to get the icon I wanted to display. This approach worked well until I noticed that my app was using approximately 4,000 GDI objects after initially loading. Eventually ran in to the 10,000 limit and kaboom!
I also tried putting the icons in to a resource file. The problem I had with this approach is that even though I used 16x16 icons, they were coming out stretched to 32x32.
I then tried using an Image list. I'm actually using multiple image lists so that I can categorize the icons. This is a little bit of an improvement, but my app is still taking up approximately 2,000 GDI objects on startup. It's also taking a lot longer to load the app.
When my app loads, I dynamically create a "ribbon bar" that has approximately 100 icons on buttons. Unfortunately, I've already distributed my app, so I would prefer to modify this dll without changing too much functionality. Currently, I pass in a string that represents the Icon I want and the dll returns an IPictureDisp for the image.
Has anyone else done something similar? What are the preferred methods here?
-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom