views:

28

answers:

1

I have a custom control which contains a panel, of which I want to be able to drop controls on in the VS IDE and have those controls actually be a child of the panel (which is a child of my custom control) and not have them added to the form my custom control is on.

Basically what happens when you drop controls on a panel not contained in a custom control.

I've tried to google it, but can't seem to come up with any good results, any help would be appreciated :)

+1  A: 

Assuming that you're talking about WinForms I think you'll get what you want if you change your custom control to inherit from ContainerControl rather than UserControl.

If it's WebForms it might be worth looking at ContainerControlDesigner, but I don't know much about that.

ho1
Is there anyway to replicate the Load event for a ContainerControl?
Blam
@Blam: Not sure which Event would be best for that, I'd suggest trying `Layout`, `GotFocus`, `Enter` or `VisibleChanged` since they all sound like they might be useful. Or otherwise you could just have an Initialize method that gets called in the Form's `Load` event.
ho1