I have a user interface that requires placing some round buttons in a C# project with some data behind them. The buttons are System.Windows.Forms.buttons and I have used a GIF image with transparency to create them. However, the transparent areas aren't transparent. I've looked for references online but haven't found any suggestions for how to do this properly. There's some mention of doing it in Visual Studio 2008 but I need to keep this project in 2005. Any help or suggestion is appreciated.
Click the button that you want to make transparent. Select FlatStyle from Properties and set it to popup Now change the BackColor property to Transparent . This will make the button transparent.
I'm pretty sure you need to use PNGs with WinForms to get image transparency. I know I've used them successfully.
EDIT: When I used the PNGs, I was overlaying them with the Image control onto the Form1.BackgroundImage; I wasn't using them in buttons.
I think your best bet is to switch from using a button control to using an image control. You might also try changing the button style to flat (I think it was flat, maybe one of the other styles) and seeing if you can get the effect you want that way.
Try this:
Bitmap temp = new Bitmap(button1.Image);
temp.MakeTransparent(Color.Black); //your transparent color, in this case black
button1.Image = (Image) Logo;
temp.Dispose();
temp = null;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With