Solved: Poor image transparency in TreeView control

.net’s Treeview control has a sticky issue when using transparent images via ImageList. Solved…

I was noticing crappy rendering when using the standard ImageList <> TreeView pairing with transparent images. An example

You’ll notice the poor alpha blending around the edges of the icons. It transpires this is a persisting ‘feature’ of the windows core. See here

The way to solve this is to produce image that pull on the treeview control’s background color to produce a new image list from an array of images with transparencies (essentially producing a solid image, but with the TV’s background color so they appear transparent). Some example code:

Results in:

About stigzler 34 Articles
Chief crook and wattle bosher.

Be the first to comment

Leave a Reply

Your email address will not be published.


*