views:

124

answers:

2

Hi

Is there any way to make a panel transparent or semi transparent?? I didn't find any aproperiate property to set transparency to panel. I was also trying to make a wpf control with grid (grid background and control background was set to transparent) and place it on normal windows form, but when I put this control on normal windows forms(not wpf) I didnt't get a transparency.

A: 

I'm not sure about making the panel semi-transparent, but I know you can use the TransparencyKey property of the form to create completely transparent sections.

For example, set the form's TransparencyKey property to Fuchsia, then set the panel's BackColor to Fuchsia, and it will create a transparent area on the form.

Edit:

Agree with @Callum Rogers about going with WPF. Text directly on the panel shows fringing (see the label in the screenshot). However, if you need to add this quickly to an existing Win Forms app and don't need to show text directly on the panel, it could work for you.

alt text

adrift
+1  A: 

Unfortunately, transparency is not natively or well supported in WinForms and is difficult to implement yourself.

If you want a transparent panel that allows you to "see through" the form, take a look at this article, which tells you to set both the Panel's TransparencyKey and BackColor to something like Fuscia. With text/other stuff in the panel this effect may not look so good.

If you want a transparent or translucent panel that shows the form below take a look at this SO question.

I would use WPF all the way, if you are able to use it in a form now.

Callum Rogers