Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need your help,
I want to know how add a form transparent inside a panel.
something like
mypanel.Control.Add(myForm);
but when I try to do this my form lose the transparent.
How I can do it?
Posted

1 solution

I assume you talk about System.Windows.Forms. Short answer is: switch to WPF. In certain problems, Forms presents serious problems with transparency, and, where those problems exist, they are not going to become easier. Transparency at the level of control is the case.

Alternatively, you can use Forms with your own rendering not at the level of controls, but within one control, using System.Drawing.Graphics directly, in the handler of the event Paint or by overriding the virtual method OnPaint. At this level, transparency is not a problem at all. Please see also my past answers:
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^].

—SA
 
Share this answer
 
Comments
Maciej Los 12-Oct-12 15:30pm    
Short and to the point, my 5!
Sergey Alexandrovich Kryukov 12-Oct-12 15:38pm    
Thank you, Maciej.
At first, I wanted to have it even shorted, with just "Switch to WPF", but the post procedure would not allow such a short line :-). So, I remembered some other approaches...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900