开发者

ImageList Transparency not working at runtime

I am using 32bit PNG files with transparency. I added them to an image list with properties:

ColorDepth: Depth32Bit
TransparentColor: Transpa开发者_运维知识库rent

When I assign the image to my toolbar button, it previews in Visual Studio fine with the correct transparency. But when I run the application the transparency is all messed up with black covering the semi-transparent regions.

How do I fix this?

ImageList Transparency not working at runtime

ImageList Transparency not working at runtime


If you add them directly to the toolbar without using an image list I think they will draw correctly.


The solution apparently is to put

Application.EnableVisualStyles();

Before the start of your application. This has fixed the transparency issue.

Solution Reference

MSDN on EnableVisualStyles

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜