Question

Using VS2005 and C#.

Having a button in a form and an image from a resource, the image does not have transparency.

How can I have transparency when assigning the image from the IDE ?

Thank you.

Was it helpful?

Solution

Open the image in an image editor (Paint.NET and GIMP are free) and add the transparencies wherever you need to.

It will all work once the image actually has transparent pixels.

You can also use a couple methods of the Bitmap class to do this:

Bitmap b = Properties.Resources.MyImage;
b.MakeTransparent(b.GetPixel(0, 0));

OTHER TIPS

I don't really understand what you are asking. You can use an image with transparency on a button as long as the image type you are using supports transparency - such as .png.

Edit: I read your question again and it is still confusing, but maybe you meant to say that you want to add transparency to the image? If so, you would have to use an image editor to add the transparency and save it in a format that supports this. Paint.Net is a good free tool for this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top