I have a base form with two buttons (e.g. OK and Cancel). I want to use a TableLayoutPanel
and have the two buttons in it. Child forms should be able to add more controls to the table as well as modify its layout itself via the designer.
So far I can't get this to work. I have tried the following:
TableLayoutPanel
to the child form. Designer refuses to add the two buttons to the panel.TableLayoutPanel
in the base form. Can't add controls to the panel from the child form.In the base form you have to set the property Modifiers = Protected for the TableLayoutPanel and any other control you want to change in the child forms.
The reason why you cant edit your TableLayoutPanel
in the derived class is because you are attempting to use a feature of WinForms called 'visual inheritance'. Unfortunately, the TableLayoutPanel
does not support visual inheritance:
http://msdn.microsoft.com/en-us/library/ms171689.aspx (read at the bottom of the page) http://msdn.microsoft.com/en-us/library/1z3efhd2.aspx
This is why it appears blocked in the inherited controls. I am not sure why they do not support this feature, but I have recently come across the same problem and ended up having to solve the problem another way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With