In VS2010, targeting Framework 4.0, I have a UserControl which contains a TableLayoutPanel with an empty second row.
Is it possible to add items to this second row using the Windows Forms Designer, or do I have to do it all via code?
EDIT: In reply to Hans Passant's comment, the linked question references a UserControl being used inside another control. I am asking a question about inherited controls.
I have created the following test code, where TestControl is a UserControl containing a TableLayoutPanel named "TableLayoutPanel1":
Imports System.ComponentModel
Imports System.Windows.Forms.Design
<Designer(GetType(testDesigner))>
Public Class TestControl
End Class
Public Class testDesigner
Inherits ControlDesigner
Public Overrides Sub Initialize(component As System.ComponentModel.IComponent)
MyBase.Initialize(component)
Dim X As TestControl = CType(component, TestControl)
EnableDesignMode(X.TableLayoutPanel1, "TableLayoutPanelX")
End Sub
End Class
Creating the following class in a new file:
Public Class TestInheritedControl
Inherits TestControl
End Class
creates a control which, when viewed in the designer, contained a TableLayoutPanel named "TableLayoutPanel1" which is not designer-editable. This is the situation described in my original question, which is not solved.
Creating a new UserControl, not inheriting from either of the previous UserControls, and then placing a TestControl into it creates an instance of TestControl with a Designer-editable TableLayoutPanel named "TestControl1.TableLayoutPanelX".
Is there any way to make the TestInheritedControl
class, shown above, Designer-editable?