I created a new frame that I wanted to register as a component. I already knew about the RegisterSprigType from this question, so it saved me some hassle.
RegisterSprigType properly prevent the designer to select, accidently move or delete controls inside your frame, but only directly. The controls inside still accepts controls to be dropped.
In my situation, I have panels inside my frame. I can drop a button on said panel. If I delete the button, then the parent get selected (which happen to be the panel) and then I can delete the panel.
I tried removing csAcceptsControls from the frame's ControlStyle. It did prevent controls to be dropped directly on the frame, but the panel inside still accepted controls.
So, I ended up removing csAcceptsControls from all controls contained in my frame in the "Loaded" procedure.
If my frame was creating controls dynamically in response to property change, I presume I would also need to override the Notification procedure to strip csAcceptsControls from any added controls.
So, my question is, is there a better way to achieve the same result (Prevent the designer to add controls inside a frame registered as a component). A "register" telling the designer to ignore the frame class and its children as containers perhaps?
If this method is already the most optimal, did I miss anything?
Is there any "gotchas" I should be aware of with this approach? (Any side effects? both design and runtime.)