docs-desktop icon indicating copy to clipboard operation
docs-desktop copied to clipboard

Images in controls

Open EFEaglehouse opened this issue 2 years ago • 2 comments

The instructions on this page are a little too brief. It mentions nothing about the image having to have transparency or an alpha channel. Even with that information, it's hit or miss for BMP images and probably other formats; however, it works for a PNG. Load a PNG image containing transparent areas into a PictureBox, set the PictureBox.BackColor = Color.Transparent and the transparency shows through the image to what's underneath.

Hard to believe we still have to struggle with transparency these days.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

EFEaglehouse avatar Sep 29 '23 23:09 EFEaglehouse

Hi @EFEaglehouse yeah the article is definitely more generic as it's talking about the "background" property and not specifically transparent hosted content such as images or icons. I think it would be a good idea to add information about the picturebox control since that's a common scenario. However, we're not really going back through and updating .NET Framework articles as we're more focused on porting them to .NET 6/7/8. As part of porting this content (when it happens) we would improve the article.

I'll leave this issue open to track it during porting.

adegeo avatar Oct 04 '23 18:10 adegeo

Also note, it's very common for a BMP to only have 24-bit pixel data, which doesn't include an alpha channel for transparency.

adegeo avatar Oct 31 '23 23:10 adegeo