I'm using ImageList
for TreeView
and ListView
. I've first set the image quality to 32 bit and then added images which are semi-transparent. The quality looks OK, but after a couple of minutes coding, compiling and executing the application, the quality looks bad.
See screenshot:
Used properties
ColorDepth: Depth32Bit
ImageSize: 16; 16
TransparentColor: Transparent
There are black pixels behind pixels which were semi-transparent but not fully transparent.
Re-adding all images restores the original quality, but after a couple of minutes, it looks like on the right side of the screenshot.
It looks like alpha channel data is lost when images are stored as
ImageStream
(default behavior of VS Designer). So if you are ok to stop using Designer to set images inImageList
, you can use semitransparent images up toColorDepth.Depth32Bit
. It is very inconvenient but it works.So you can put your images to
Resources.resx
file, and add them in appropriate place in code. For example in constructor of youUserControl
/Form
, after call toInitializeComponent()
by code like this:(This info is available in comments to response marked answer, I've added this as answer so it would be harder to miss another available option)