Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have an ImageList with some images, all of them are png with transparency and the transparency is working correctly. The images are somekind of square with a little outline in a transparent background. On the main form, I have a picturebox that will take one of the images in the listbox. The image it will take will be different acording to some arguments, but that doesn't really matter I think.

 

To apply the pictures I do something like this:

 

frmMain.pic1Enabled.Image = frmMain.imgLabels.Images.Item(0)

 

The problem is that the image does not have the correct colors I designed in the first place. The outline is somewhat blue where it should be gray. The rectangle background is also a little blueish...

  • Leaders
Posted
Try setting the ImageList's ColorDepth property. By default it is 8 bits per pixel, which is just, well, silly, because it makes gradients, detailed color, and alpha transparency look all kinds of bad. You may or may not have to remove the images from the ImageList and then reload them (after you change the ColorDepth) in order for them to appear correctly.
[sIGPIC]e[/sIGPIC]
  • Leaders
Posted
Then I can't think of a reason why this shouldn't work. Have you tried reloading the images into the ImageList? Is the ImageList populated at run-time or design-time? Maybe you ought to post the code that populates the ImageList and the code that takes the image from the ImageList and shows it in the PictureBox.
[sIGPIC]e[/sIGPIC]
Posted

The ImageList is populated at design-time and the code that takes the image from the ImageList and shows it in the PictureBox is already in the first post.

 

For the generated designer code, check this file:

http://stuff.nazgulled.net/code/vb.net/FormProfilesManager.Designer.vb

 

The ImageList control is called imgLabels and the PictureBox controls that will take images from it are named pic1Enabled, pic2Enabled, pic1DHCP and pic2DHCP.

  • 4 years later...
Posted
Try setting the ImageList's ColorDepth property. By default it is 8 bits per pixel, which is just, well, silly, because it makes gradients, detailed color, and alpha transparency look all kinds of bad. You may or may not have to remove the images from the ImageList and then reload them (after you change the ColorDepth) in order for them to appear correctly.

 

 

I was having the same problem and bumped into this forum. If the clarity of your picture is not working properly when retreiving the image from an imageList and transferring to a picturebox, it's most likely because you must change the ColorDepth property first. Then, you reload your images into the imageList collection, manually, like you did when you set up the collection.

 

Thanks snarfblam for providing the correct path to take when having the issue this forum was set up for.:D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...