First off, i'm writing a launcher program. It's going to have a context menu with all the apps that the user added (and their respective icons).
Considering that someone might put in 40 apps, that might take a while to cache EVERY icon EVERY time the program starts.
My solution was to add all the icons to an Arraylist and SERIALIZE the arraylist into a .dat file (just plaintext).
Problem: The icon that i add to the arraylist is 256/true-color with alpha transparency. The icon that comes out when i deserialize it is invariably 16 colors with no transparency/regular transparency.
i did some tests, this has nothing to do with the limitations of the icon class. (i displayed the before/after icon for myself). Also, i tested and it has nothing to do with how i'm storing the ArrayList of icons in a .dat file.
does anyone know what is going on or another way i could cache the icons without putting them into separate files?
Sorry I have no idea what the problem is. I took a collection of icons each with multiple images, used your code to serialize and deserialize and basically got back what I put in.
The only thing I can think of is that .NET itself does not particularly use icons. All controls know how to display a single bitmap. The icon property on a Form seems to be the only place where an Icon can be set. How the Form selects a particular image from the Icon I do not know.
Useful? Then click on (Rate This Post) at the top of this post.
No I didn't pull the icons from an exe I don't have any code to do so.
In the attachment is an icons.dat file containing one icon with multiple images with alpha transparency.
The only way I could verify this was with a third party icon viewer. Visual Studio doesn't appear to be handle it very well. So this could be your problem.
Useful? Then click on (Rate This Post) at the top of this post.
yes norfy, i have come to the same conclusion. thank you very much for your help, it helped me clear a few things up.
the problem has to do with the .net classes, they aren't very adaptive i guess... you'd expect more from microsoft seeing as how they released the alphatransparency control library in the first place, but oh well.
i saw that. his problem has to do with the classes he uses. if i look at the icon before serializing it, it will be (possibly) 32bit with alpha. it's the serializing that messes it up.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.