Take the 2-minute tour ×

I'm developing a winforms application (using .NET 3.5)

In a form I have a panel control ,and a datagridview control inside of it .

I want to have some control ( let's say for the simplicity - a label) to appear in front of the datagridview , and I want this label to be transparent - which means : I want to see the data displayed in the gridview behind .

I just want to see the text that is in the label , but not the whole rectangle .. and behind that text - to see the data I have in the gridview.

The problem is the following : the parent control of the label is not the gridview (since it's not a container control ) . The parent of the label , is the panel control .

So when I set the label to be transparent .. I actually get transparency to the panel , and not to the datagridview.

Here is the screenshot : screenshot This shows the situation ( the actual control I want to display is not a label , but rather a custom control I've downloaded)

Any ideas.. ???

share|improve this question
add comment

2 Answers

Set the panel to also be transparent. It shouldn't cause any trouble with the panel, since you'll still have the form itself behind it.

There is one other issue to warn you about as well. Transparency in winforms controls is only simulated or faked, in that when you create the control it takes an image of the form behind the control and uses that for the background, rather than truly making it transparent. This can cause issues if that background changes or the controls moves around on the form.

share|improve this answer
well.. I think that I actually need to trully make it transparent. Since the solution you proposed does not help - I now see the form in the background . I need to see the data displayed in the gridview behind my control .. and it sure changes and is not static.. –  Alex Nov 10 '09 at 14:37
add comment

Check out this CodeProject article: How to Use Transparent Images and Labels in Windows Forms

Also, you could always use GDI (System.Drawing) and just draw what you want directly onto a transparent panel?

share|improve this answer
In Winforms, if you want true transparency, GDI+ is your best bet. –  Stewbob Nov 10 '09 at 14:50
I implemented the solution described in the linked post, but I got a problem: when I drag my form, the background it captured in the previous position is dragged to the new position... –  Jader Dias Sep 1 '10 at 16:46
add comment

Your Answer


