How do we overlay and use transparency in User Controls in VB.Net 2005

[ To help explain this problem, we have created some screen dumps - but EE doesn't seem to allow us to paste them in here, so I have stored them elseehere and posted URL's to them ]

We have a windows form control (in our case a MDI sub form). We want to put user controls on that form. These user controls can and will overlap, in fact each control overlays the previous control. We want the previous control to show through AND allow use of the underlaying controls  controls.

So a form might contain 2 controls all of which should be visible and usable.

See screenshot for example :

This form contains two controls usercontrol1 and usercontrol2. In the illustration above usercontrol1 overwrites usercontrol2 preventing usercontrol2 from being used. We want usercontrol1 to be transparent AND we want to be able to use the controls on usercontrol12 even though usercontrol1 overlays usercontrol2.


The controls on the form will be built up in layers thus :-
So this is our initial form with one usercontrol placed on it ( )

This is after user control1 has been put on the form now we add usercontrol2 which overlays usercontrol1 and in our case it not only obscures usercontrol1 but also prevents use of the usercontrol1.button2 button.

Now we add another usercontrol(3) and again we want to (see and) use the controls on usercontrol1 and usercontrol2 underneath (as well as the controls on usercontrol3). 

There appears to be two main issues:-

1) Providing transparency.
2) Allowing access to the overlapped controls.

We have tried using the various transparency settings provided by .NET.

Setting SupportsTransparentBackColor to true, UserPaint to False and setting the backcolor to transparent does provide a kind of transparency however we then run into painting issues  snippets of previous screen data left from previous screens.

Additionally we are still unable to use any of the controls that appear underneath an overlapped control.

Also tried using             'MyBase.BackColor = Color.FromArgb(65, 204, 212, 230)

But this just allows you to alter the degree of transparency.





Who is Participating?
SStoryConnect With a Mentor Commented:
I may be wrong, but I am thinking that the only way to make this happen from one control to another would be by capturing all messages on the top most control and using SendMessage API to feed them to the control underneath it. As for transparency, this obviously works by painting control one with alpha channel, or, by setting control one's background to what is painted on the parts of control2 that are in under control1. Either way is a lot of work.  I have found that for drawing apps, Double Buffering should be turned on. Also, a call to .Refresh is often necessary for things to repaint correctly.  Graphics are NOT very fast in .NET

A great GDI+ resource is found at:

Sorry I can't help you more.
Forced accept.

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.