Truely transparent form

P

Per Larsson

Hi all!
I am working with a project and want to make a form that is truely
transparent.
(Se through and click through.)
I can make it transparent by setting the Opaqe property, and by
setting the TransparencyKey colour I can make it click through in
parts that then becomes invisible.
But I want the hole form to be "click through". All controls, frames,
bars and everything!
It seems that there is no support for that in VB.net, but I have seen
VB6 code
that can do it by using Windows API´s.
Does any one know how to do that inb VB.net?
 
H

Herfried K. Wagner [MVP]

Per Larsson said:
I am working with a project and want to make a form that is truely
transparent.
(Se through and click through.)
I can make it transparent by setting the Opaqe property, and by
setting the TransparencyKey colour I can make it click through in
parts that then becomes invisible.
But I want the hole form to be "click through". All controls, frames,
bars and everything!
It seems that there is no support for that in VB.net, but I have seen
VB6 code

Create a 'GraphicsPath' of appropriate shape, then create a 'Region' from it
(see 'Region' constructor) and assign it to the form's 'Region' property at
runtime.
 
P

Per Larsson

Thank you for answering!
Got the Region OK, but how do I make it transparent to mouse clicks?
Used this code:

Dim p As New System.Drawing.Drawing2D.GraphicsPath()
p.AddRectangle(New Rectangle(0, 0, 600, 400))
Me.Region = New Region(p)

Did I get something wrong?
 
H

Herfried K. Wagner [MVP]

Per Larsson said:
Got the Region OK, but how do I make it transparent to
mouse clicks? Used this code:

Dim p As New System.Drawing.Drawing2D.GraphicsPath()
p.AddRectangle(New Rectangle(0, 0, 600, 400))
Me.Region = New Region(p)

Did I get something wrong?

Your code should work. Everything outside the region will be completely
transparent, and clicks will be forwarded to the underlying window, not your
window.
 
P

Per Larsson

OK!
It doesn´t solv my problem then.
I want the form to be visible but transparent (opaqe) and the mouse
clicks to go through the form to the underlying window.
/Per
 
P

Per Larsson

That was cool, but not what I am after.
I want the form to be visible but transparent (opaqe) and the mouse
clicks to go through the form to the underlying window.
/Per
 

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

Top