Skip to content

Do not create image masks in ImageList when using 32-bit color depth (or provide a way to disable it)Β #14171

@xPaw

Description

@xPaw

.NET version

10.0

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No

Issue description

See this article from 2004 with a fix: https://www.codeproject.com/articles/Adding-and-using-32-bit-alphablended-images-and-ic

Specifically, when using ImageList = new ImageList { ColorDepth = ColorDepth.Depth32Bit }; the image list still creates a mask which causes poor anti aliasing on transparent pixels in the bitmap.

The fix in that article is to manually call windows ImageList_Add without the mask. I've tested this in .NET 10 and the fix works and fixes icons having bad transparency in trees/lists/tabs.

before:

Image

after:

Image

look closely, you can see gray pixels when not using the fix

Steps to reproduce

Create a imagelist, add it to a treeview, and add a bitmap image that has transparent pixels (not fully transparent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.DrawingSystem.Drawing issuesuntriagedThe team needs to look at this issue in the next triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions