Transparent control!

R

Raj

Hi,

Anyone has any idea as to how we can make a button or any standard windows
control as transparent or semi-trnasparent. How can we do this in C#?

Thanks,
Rajendra
 
G

gmiley

To make it transparent, you can set the controls BackColor to
System.Drawing.Color.Transparent

To make it Semi-transparent may require a bit of fenagling (spelling,
maybe?).

Create a transparent image, with a light grey mesh pattern. basically
1x1 pixel transparent holes. Then set the Controls .BackgroundImage to
that image.

In the controls set-up:

this.button1.BackColor = System.Drawing.Color.Transparent
this.button1.BackgroundImage =
((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));

with the above, the image has been added to the applications resource
file, so it accesses it through there, I don't recall having to ever do
it manually, but there is a way to load an image by hand (opposed to
using the properties sheet).
 
G

Guest

Also take a look at the Opacity property for a form. It's a quick-n-dirty
solution in simple cases.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top