[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1531
  • Last Modified:

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 : http://picasaweb.google.com/iambigchris/Misc/photo#5123057208743171058

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.

Layers

The controls on the form will be built up in layers thus :-
So this is our initial form with one usercontrol placed on it ( http://picasaweb.google.com/iambigchris/Misc/photo#5123057213038138370 )

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.
http://picasaweb.google.com/iambigchris/Misc/photo#5123057221628072978

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).
http://picasaweb.google.com/iambigchris/Misc/photo#5123057230218007586 

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.
http://picasaweb.google.com/iambigchris/Misc/photo#5123057243102909490

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.

 

 

 

 

 
0
e_bigchris
Asked:
e_bigchris
1 Solution
 
SStoryCommented:
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: http://www.bobpowell.net/faqmain.htm

Sorry I can't help you more.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now