why doesnt user control support transparent ?

T

Tom

why doesn't user control support transparent ?
even after you programmatically make it transparent the controls that you
add on it still doesn't transparency where they normally would in a winform
why is that ?

Tom
 
N

Nicholas Paldino [.NET/C# MVP]

Tom,

I believe it has something to do with win32 itself, and not .NET in
particular. While it's not the best answer, MS's overall response to this
will be to use Avalon, which will correctly support control transparency.

Otherwise, you would have to keep track of all the windows below yours,
and paint it manually.

Hope this helps.
 
C

Cor Ligthert

Tom,

Try this

Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.Transparant

I hope this helps

Cor
 
C

Cor Ligthert

I answered it from the general group. It is VB style, so "me" has to be
"this" for C# and it has to be closed with ; watch also the cases I did not
real check for that.
 
T

Tom

I have no problem with the usercontrol being transparent.. but it seens for
EVERY control I add to the usercontrol I need to write a separate inherited
control to make it transparent and its a headache for me.

Thanks anyway
Tom
 
G

Guest

Hi tom the method you suggest does not make a windows form control for C#
transparent. Although transparent is initially accepted the program crashes
after a few seconds. The code for C# is also different from this even
including "this" and";"

AR
 
R

Richard L Rosenheim

You can utilize this code to make an user control transparent:

In the user control's Load event:

SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.BackColor = Color.FromArgb(0, 0, 0, 0)

I actually just found the above code on a web page couple hours ago (sorry,
I don't have the link handy). It seems to work fine in VS 2003, but in my
case, the background is just a colored panel. I have also seen messages
that indicates that there is a bug in the Whidbey release that causes the
underlying display to not display properly.

Richard Rosenheim
 

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