Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net & C#: Trying to have a transparent image on a button (assigned from IDE)

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.

like image 597
Stécy Avatar asked Feb 01 '26 08:02

Stécy


1 Answers

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));
like image 98
Ed S. Avatar answered Feb 02 '26 21:02

Ed S.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!