I am looking for a way to allow application users to design the controls on a given form at run-time. I have researched the use of the DesignSurface class, but wish to give the ability to design "in place".
For instance, if I have a ToolStripContainer on my form with controls on the ContentPanel area, I would like to allow the controls to be designed directly in the ContentPanel.
I have already attempted to declare ControlDesigner instances and calling the Initialize method, passing in the control I would like the designer to handle. To much avail, I receive "object reference not set to an instance..." errors as soon as I mouse-over the control.
Example:
| |
ControlDesigner controlDesigner; foreach(Control control in toolStripContainer.ContentPanel.Controls) {
controlDesigner = new ControlDesigner(); controlDesigner.Initialize(control); }
|
Anyone know how I could get this to work
Thanks.
Design controls at run-time without DesignSurface?
Fabio Schorn
In the meantime, Mike Harsh's Design Mode Dialog sample on WindowsForms.net (http://windowsforms.net/Default.aspx tabindex=4&tabid=49) might help you get started with designer hosting.
Raghavendra