ImageList: 32-bit Images lose quality

纵饮孤独 提交于 2019-11-29 13:52:22
Woodman

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 in ImageList, you can use semitransparent images up to ColorDepth.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 you UserControl/Form, after call to InitializeComponent() by code like this:

  _imageList.Images.Add(Resources.Image32);
  _imageList.Images.SetKeyName(0, "Image32");
  _myButton.Image = 0;

(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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!