开发者

WPF Images - Trying use to use treeview, but can't get background to be clear [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 7 years ago.

Improve this question

Greetings,

I have a TreeView containing a set of TreeViewItems - Each TreeView is pretty simple (just some text, plus an image) - The images are usually folder & files icon. All good and simple...except for the fact that since the contents of images do not fit an exact square, there is some white background surrounding portions of each.

Of course, the problem then is that when drawn and then selected by the user, the unsightly white pixels of the image background get displayed (instead of being clear and blending with the highlighting), creating a rather amateur look.

It's been a few years since I've done heavy Windows GUI programming, but I recall in Win32/MFC, there used to be a single, handy value that you could set which contained the color that should not be rendered for 开发者_运维知识库an image (preventing this problem). But I don't know what is offered in WPF that would offer similar capabilities.

Any advice?

Thanks!


Instead of using chroma key (which is so 1990's) you should convert the images to PNG or Bitmap format with proper alpha (transparency) information.

WPF will honour the alpha when it renders the images, which should take care of the white background. Because there are 256 levels (instead of the two offered by chroma key) you'll also be able to get much smoother edges as they can be properly antialiased.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜