2

m developing a sort of project which I needed a cool customizable interface, so I designed a 'parent-form' from which all childs would get 'stylized', according to XML customization options. I added a TableLayoutPanel to draw borders and a Panel in the middle, where child forms would supposedly add their components and make their jobs.

The problem I face is, even though I set that 'content panel' to 'public', the designer wont let me add controls to it from the child forms.

Is there any different way I can make designable forms deriving from a 'customizable' superclass?

Edit: The parent class is public, every container containing the Content-Panel are also set to public.

enter image description here

Felype
  • 3,087
  • 2
  • 25
  • 36
  • possible duplicate of [How to enable design support in a custom control?](http://stackoverflow.com/questions/2785376/how-to-enable-design-support-in-a-custom-control) – Hans Passant Sep 22 '13 at 17:41

2 Answers2

1

I manually added to child's designer.cs a new Panel inside the parent's content pane, set it to DockStyle.Fill. When I came back to the Designer, it will now let me add components to child's content Panel.

A bit messy and I'm pretty sure there shall be another way around...

But I'll work along like this until i can figure out a better workaround.

Felype
  • 3,087
  • 2
  • 25
  • 36
1

I have added a new public Panel from code other than designer in the parent's class scope, Then in the parent constructor I added it to the TableLayoutPanel, configured docking and colspan from constructor code, below InitializeComponents() call and BAM!

    public Panel contentPane = new Panel();

    public Dialogo()
    {
        InitializeComponent();
        Content.Controls.Add(contentPane);
        contentPane.Dock = DockStyle.Fill;
        // More code
    }

So its a contentPane inside 'Content' which is another panel in the second line of the table ocupying 5 columns (so the table surrounds it and allows me to draw the borders around. I don't know why, but having added the content-panel in code other than on the designer allowed me to directly add components to the panel from the Designer in child forms.

Felype
  • 3,087
  • 2
  • 25
  • 36