views:

430

answers:

1

I've written a custom tab control (FooTabControl) which hosts specific tab page controls (FooTabPage instances). The FooTabPages know to place themselves into a dedicated area within the FooTabControl.

Now I wish to have the FooTabControl also host a System.Windows.Forms.Panel child control (in another dedicated area of the FooTabControl). I want the user to be able to place his controls into this Panel, but disallow him from removing the Panel control itself (while still being able to add and remove FooTabPages as he sees fit).

What would be the proper way to implement this?

A: 

You need to override CreateControlsInstance (in the custom control) and return you own implementation of ControlCollection.
In your implementation your will override Remove to disallow removing the Panel.

Shay Erlichmen