Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / December 2005

Tip: Looking for answers? Try searching our database.

IDesignerHost manually add component

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lance Johnson - 16 Nov 2005 01:10 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.