I have form setup to perform designing of a form. There's a toolbox that
you can design from and everything. However, one thing I can't figure out
how to do is manually add an item to be designed. Let's say that I want to
add a TextBox to this. How do I go about this? Do I need to use the
IDesignerHost, IRootDesigner, or what do I need to do?
And perhaps I'm going about this in the wrong way, but we're going to allow
users to layout a custom form themselves. And we'll control the basic
elements such as the location and such. And then I want to manually add
these to the design surface. Let me know if there's an easier way to do
this such as serializing and deserializing. I'm sure there is, but I can't
exactly find the articles for doing this.
Lance Johnson
InK_ - 16 Nov 2005 08:52 GMT
Hi!
I had similar task and I had to implement IDesignerHost,
IContainer,IServiceContainer and etc. to do this.
Form will be in design time when you add it to your DesignerHost
implementation.You should detect when the contol was dropped to the design
surface and add it to the host using CreateComponent or AddComponent.
Implementation of INameCreationService, ISelectionService is also needed.
For more details you can read this article:
http://www.divil.co.uk/net/articles/designers/hosting.asp
Regards,
InK_
> I have form setup to perform designing of a form. There's a toolbox that
> you can design from and everything. However, one thing I can't figure out
[quoted text clipped - 10 lines]
>
> Lance Johnson
Fitim Skenderi - 08 Dec 2005 14:29 GMT
Hi Lance,
You create a control manually as you would normally do. Then you need to get
IContainer interface from the ServiceContainer (the container that holds
IDesignerHost, IContainer, ...). This Interface has a method Add(...) which
accepts IComponent interface (which is implemented by any Windows control so
you do not need to worry there)
hope this helps
Fitim Skenderi
>I have form setup to perform designing of a form. There's a toolbox that
>you can design from and everything. However, one thing I can't figure out
[quoted text clipped - 10 lines]
>
> Lance Johnson