Hi, I'm in trouble with using designsurface to resolve my specified application's requirements
I've read some articles about custom form designer, but none of them resolve my problem
My problem is:
When in designer, i load a form as the root component in designer host, the pick up a SplitContainer in toolbox and drag into form. My form now have a control as form.Controls[0]
A) if i add control by code with
Form form = host.RootComponent;
((SplitContainer)form.Controls[0]).Panel1.Controls.Add(new TextBox());
-> The textbox display in designer surface but can not be selected to resize, move, edit properties, etc..
B) If i add control by code with
IToolboxUser rootComponentDesign = (IToolboxUser)host.GetDesigner((IComponent)host.RootComponent);
rootComponentDesign.ToolPicked(new System.Drawing.Design.ToolboxItem(typeof(TextBox)));
-> The textbox display in designer surface and can be selected to edit resize, move , edit properties... etc. But it is always added into Panel1. Assume i want to add a TableLayoutPanel in Panel 2 of the SplitContainer, and then add a Control to column 1, row 1 of that TableLayoutPanel. How can i do that with designer functionalities of by code?
If i add control directly to control by way "A)", i can not using its design mode functionality
Form form = host.RootComponent;
TableLayoutPanel table = new TableLayoutPanel();
((SplitContainer)form.Controls[0]).Panel2.Controls.Add(table);
table.Controls.Add(new TextBox(), 1, 1);
If i add control indirectly to control by way "B)", i can not set some parameters of adding control, such way "A)"
Please show me how to resolve my problem.