473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Transparent Button in C#

5
I have a button in c# windows forms and set the image property of that button as menubtn.png (i want the transparent image)
But it doesn't work and show white color.
I also set the BackColor property to Transparent and it also shows white color.
How can I get the transparent button?
May 3 '10 #1

✓ answered by tlhintoq

Helpful links, if you have bitmap without transparancy. But since you are using a png that is already transparant you don't have to go through all that.

I had no need to play silly games of matching the button color to the form transparancy key. Why do all that?

Set the button back color to transparant.
Set the button FlatStyle to flat.
Place the .png.
Done - get back to writing code.

You have to set the FlatStyle, because otherwise the O.S. theme of 3d style will cause it to do all the fancy glass and reflection effects when painted, thus overriding the transparency. It's one of those things that makes sense in hind-sight but will keep you guessing for a while the first time.


4 14714
Monomachus
127 Expert 100+
@khaing
Google/Bing is your best friend. Common guys.

Link 1. .Net & C#: Trying to have a transparent image on a button
Link 2. Button Image Transparent Background
May 3 '10 #2
ThatThatGuy
449 Expert 256MB
@khaing
Set the Back color of the button to some color and then change the Transparency Key of the form to the color you chose for the button's back color...

you'll have a transaprent button
May 3 '10 #3
tlhintoq
3,525 Expert 2GB
Helpful links, if you have bitmap without transparancy. But since you are using a png that is already transparant you don't have to go through all that.

I had no need to play silly games of matching the button color to the form transparancy key. Why do all that?

Set the button back color to transparant.
Set the button FlatStyle to flat.
Place the .png.
Done - get back to writing code.

You have to set the FlatStyle, because otherwise the O.S. theme of 3d style will cause it to do all the fancy glass and reflection effects when painted, thus overriding the transparency. It's one of those things that makes sense in hind-sight but will keep you guessing for a while the first time.

May 3 '10 #4
khaing
5
I found why my procedures doesn't work for transparent button.
It's my thinking wrong.

The back color of my form is white. I add a label and set it's image. I put the transparent button onto that label. It's normal that I can see only white color because the form's back color is white.

When I put a transparent button onto something, I think wrong I can see anything what's at the back of it (in this case, the color of image).

I want transparent button because my buttons are rounded rectangle so the corners of buttons are white.

Thanks all for replying.
May 5 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jan Jørgensen | last post by:
There has been a lot of discussion about the possibility to change the backgroundcolour of buttons. Lot's of people are referring to lebans homepage. But there is actually an easy way to do...
0
by: eruess | last post by:
Here's the scenario: I've got a whole bunch (for the sake of argument, let's say thousands) of different little 32x14 .png files that act as buttons all over a very large website. Each button...
2
by: =?Utf-8?B?SGFucyAtIERpYUdyYXBoSVQgLQ==?= | last post by:
Hi! I have a windowsform with an imagebox inside a groupbox. The imagebox shows a image of a man with joints (for medical purose - shoulder, ancle, wrist etc.). The user is able to mark the...
2
by: harmansodhi03 | last post by:
I have assigned an image to form. Now i want to create a transparent button on the form. Please reply. Harman
1
by: Nick Verlinden | last post by:
Hi there, i'm trying to accomplish the following (however searching the net for days now, without result): As you know you have a asp button: <asp:Button ID="test" Text="Test"...
2
by: Frank Rizzo | last post by:
I am looking for an implementation of a button control that has the functionality of a button on a toolbar control. In another words, the background needs to be transparent, the borders gone (or...
3
by: adsaca | last post by:
How to make a transparent button in vb.net(windows application) any help pls, tnx, arjel
1
by: Alkdarf | last post by:
I monitor door cameras with a third party application that gives me multiple video windows for the various video inputs in the card. I want to create an application that will overlay the video...
1
by: wegomadave | last post by:
Running a very large HMI program for a machine. Opens and closes many forms. For no good reason one of my command buttons become transparent. Just seems to happen. Once it does it stays that way...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.