|
-
Jul 10th, 2006, 09:47 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] Alpha channel and ImageList?
Hello everyone,
I would like to store some icons inside my application (so no extra files are needed to run the app), so I used an ImageList, but this seems to screw up the alpha channel of the icons.
I have a form with a StatusStrip control on it. In this strip is a StatusLabel with an image next to it. When I load an icon with alpha channel directly from file to set as it's image it displays fine, but when I load the same icon into an ImageList and set it as the StatusLabel's image, all pixels that have an alpha other than 0% or 100% are displayed as blue.
Changing the ImageList's ColorDepth value does not solve this problem.
I would really like the icons to display correctly.
Thanks for any help.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
Jul 10th, 2006, 10:01 AM
#2
Re: [2005] Alpha channel and ImageList?
ImageLists don't store icons. If you add an icon the image format will be changed. Just go to the Resources tab of the project properties and add the icon as a genuine Icon resource. If you name it MyIconResource you would then retrieve it as an Icon object as My.Resources.MyIconResource. Having said that, ToolStripStatusLabels don't display icons either. They will also change your image format but not in the same way as an ImageList. I'm not sure of all the technicalities mind you, but that's the bones of it.
-
Jul 10th, 2006, 10:07 AM
#3
Re: [2005] Alpha channel and ImageList?
I have seen it indicated that its a bug that the alpha channel is lost when adding images to an image list.
You are better off making a resource file and embedding the images in that, and extracting them for use at runtime, they should keep their alpha channel that way
-
Jul 10th, 2006, 10:43 AM
#4
Thread Starter
Fanatic Member
Re: [2005] Alpha channel and ImageList?
I have now added the icons to my resources and it works fine.
But I have one more question: how to set an image from the resources through code?
I can change it within VB itself, simply by changing the image-property. But I don't know what to do code-wise to make this happen...
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
Jul 10th, 2006, 10:53 AM
#5
Re: [2005] Alpha channel and ImageList?
use the My namespace.. for example, lets say one of your resource images was a car (and you named it car in the resource file)
you would just do
VB Code:
MyStatusStrip.BackgroundImage = My.Resources.Car
-
Jul 10th, 2006, 10:58 AM
#6
Thread Starter
Fanatic Member
Re: [RESOLVED] [2005] Alpha channel and ImageList?
Thanks, works like a charm!
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
Jul 10th, 2006, 10:59 AM
#7
Re: [RESOLVED] [2005] Alpha channel and ImageList?
yeah, you gotta love the My namespace.. back in .net 2003, you would have to use a few lines of reflection code to extract the image from the exe and use it at runtime
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|