Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Hosting a designsurface within a designer
 

Hosting a designsurface within a designer

Hi,

I'm not sure if this is supported but I've been trying todo the following within VS2005:

- I have a custom component that has a custom root designer. To properly design this component, I need to host a new form designer within a portion of my component's designer. I need to track changes to the form to properly manage the state of my components. The embedded form won't be serialized.

I've had partial success by creating my own root designer and then placing a DesignSurface within part of my design window. I pass inmy component's designer host for the service provider for the design surface. It kind of works except that the PropertyGrid isn't tracking selection changes from within the embedded form designer, it tracksthe top-level designer changes even though I activate the embedded designer.

Here's a sample of my code that creates the embedded surface:

IDesignerHost designerHost = this.parentDesigner.DesignerHost;

IServiceProvider svcProv = (IServiceProvider)this.parentDesigner.DesignerHost;

DesignSurface embeddedDesignSurf = new DesignSurface(svcProv, typeof(Form));

embeddedDesignSurf.Initialize(); // CALLS IDesignerHost.Activate() for the embedded designer.

Control c = designSurf.View as Control;

c.Dock = DockStyle.Fill;

c.Parent = this; // a root designer's view control

Can anyone please help? Is this a proper way to do this and how can I make the property grid work? Is there a better way to do this?

Joe Burke  Sunday, April 02, 2006 6:23 AM

Joe, here you can find a goodarticle on designer hosting:

http://msdn.microsoft.com/msdnmag/issues/06/03/DesignerHosting/default.aspx

I hope this helps

haliwo  Sunday, April 02, 2006 5:43 PM

You can use google to search for other answers

Custom Search

More Threads

• unable to open any windows form in the windows designer.(Make sure the application for the file type(.cs) is installed)
• UserControl TestContainer not automatically run with nested projects
• AutoComplete ComboBox with DynamicItemsList
• How could i just add control to specified type of control ,like a Panel .
• Location of view designer on windows visual basic 2005 express edition
• Error HRESULT E_FAIL
• ContainerControl inside another ContainerControl
• Auto generation annoyance
• Design view crashes when Visual Studio is previously closed with our forms open
• set selected index of combobox column in datagridview