2
votes

I have a Form, that has a BackgroundImage, and the BackColor of form is set to red. Then, I try to add a panel on that form, set panel's Background to Transparent, but it inherits Form's BackColor and thus panel's background becomes red.

How do I "tell" the panel not to inherit Form's BackColor, but Form's BackgroundImage?

Update: It's working fine on Windows 7, but not on Windows XP (SP3).

Fixed: The problem was caused by overriding Form's CreateParams and turning on WS_EX_COMPOSITED

2
It is not the case when I try it. What version of VS are you using? - tafa
Do you want your panel displayed behind of the program ? if you set its background transparent, it must show its parents background. - icaptan
tafa: vs2010. yes in visual studio it works, but when i try to debug on Win Xp...it's not working! @icaptan: yes it shows it's parent's background. but it's parent (form) has an backgroundimage ...so i need that - technology
it works on windows 7 and not on Xp ? - icaptan
yes. on xp panel becomes white. on win 7 works fine. - technology

2 Answers

1
votes

change the panel property BackColor to Transparent [web tab]

1
votes

That is because Windows Forms ask for the backcolor of the parent control when current control's backcolor is set to transparent. Transparent Panel