Adding controls to a panel in a UserControl?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm developing a UserControl that has 2 panels - one docked top and the other fill. I want to be able (at design time) to drop controls on the panel docked to fill, but when I do so, the newly added control is added to the base UserControl's control collection and not the "fill" panel. Intercepting the OnControlAdded event and changing the parent of the new control just gives me an error message "'child' is not a child of this parent". Bringing the new control to the front doesn't work either as it's still parented by the base control and is "painted over" at runtime by the fill panel. I thought this was an easy one, but I've spent a couple of days (and nights) on it. Any help at all is really appreciated
Thanks in advance. Tim
 
Hi Tim,

You ave to add some design time support to your control.
Check yout the articles in this site. I believe you'll find some useful ones


--
B\rgds
Stoitcho Goutsev (100) [C# MVP]
Tim Swords said:
I'm developing a UserControl that has 2 panels - one docked top and the
other fill. I want to be able (at design time) to drop controls on the
panel docked to fill, but when I do so, the newly added control is added to
the base UserControl's control collection and not the "fill" panel.
Intercepting the OnControlAdded event and changing the parent of the new
control just gives me an error message "'child' is not a child of this
parent". Bringing the new control to the front doesn't work either as it's
still parented by the base control and is "painted over" at runtime by the
fill panel. I thought this was an easy one, but I've spent a couple of days
(and nights) on it. Any help at all is really appreciated.
 
Thanks Stoitcho. I was afraid that was the path I needed to take. I guess it's time to roll up the sleeves and get dirty.
 
Back
Top