title: How do I create a custom control with a sub-panel that accepts other controls at designtime?
body: <p>I have written a custom control, that has several sub panels. I want these sub panels to accept any additional controls dropped on them at design time.</p>
  
  <p>Unfortunately any control that gets dropped at design time ends up on my custom control, not on the panels. This shows in particular if I try to drop a label: The label's blue dots are shown, but it's caption isn't and if I deselect the label, it is no longer visible at all.</p>
  
  <p>simplified code (only one sub panel):</p>
  
  <pre><code>type
    TMyContainer = class(TPanel)
      p_SubPanel: TPanel;
    public
      constructor Create(_Owner: TComponent); override;
    end;
  
    constructor TMyContainer.Create(_Owner: TComponent);
    begin
      inherited;
      p_SubPanel := TPanel.Create(Self);
      p_SubPanel.Parent := Self;
      p_SubPanel.Align := alClient;
    end;
  </code></pre>
  
  <p>What am I doing wrong here?</p>
  
  <p>(Just in case it matters: I am using Delphi 2007.)</p>
  
  <p>[edit]</p>
  
  <p>I have now solved it differently. The component no longer contains panels but refers to external panels. This makes it actually much more flexible, but on the downside it is no longer as intuitive to use.</p>
  
  <p>I would still like to know how to accomplish what I described originally. Isn't there an open source component somewhere that does this, so I can study the source code?</p>