.NET Hobbyist Programmer

Staying Confused in a Busy World
posts - 257, comments - 204, trackbacks - 673

My Links

News

Neat Stuff Read all my hurricane entries While you are here, visit the Geeks With Blogs main feed
Advertising
Links Status of the Navy
Channel 9

Tag Cloud

Article Categories

Archives

Post Categories

Implementing a Custom Forms Designer in .NET

Update: I have started a series of posts which will build towards implementing as full-featured design surface as I can manage.  The series begins here.

Over the past few years, I have been doing some research on implementing a forms design surface within a program.  I see it as a way to provide a visual design connection for my next major project when we move a VB6 program that is very forms intensive to one that is much less so and is focused on user design and documents.  Here are some of the references I have found on the subject.

June 2002: MSDN, Creating a Design Surface Using Windows Forms and GDI+ in Microsoft .NET [article and code: DesignSurface.exe]

This effort was the first wholly manual version that I came across and only handled simple shapes.  When I understood what was going on, I realized that it was trying to duplicate much of what was in Visual Studio using a brute force approach.  This was way too much work when what I wanted was already in the Framework.  I did not like the idea of doing so much work, so I waited.

June 2003: Website, Hosting Windows Forms Designers, [article and code: hosting.zip]

Tim Dawson comes out with the first article describing of how the forms designer in Visual Studio worked.  This is a great article and seems to have been the first detailed description of the process and classes required.  Excellent.

June 2003: Website, SharpDevelop, [see site for description and code]

Around this same time, the SharpDevelop folks were working on their open source Visual Studio substitute, now in version 1.0.  This included implementing a design surface using much the same technique as Visual Studio.  The down side of their work is that it was highly dependent on their system, especially their complex plug-in architecture.  I found the Dawson article somewhat confusing and the SharpDevelop implementation very confusing.  Since I was not in need of immediate action, I waited.

August 2004: Microsoft Knowledgebase, INFO: Code Sample That Demonstrates How to Create a Custom Form Designer by Using Visual C# .NET [article and code: DesignerHost.exe]

This is a very basic article that essentially just points to the code sample for the explanation.  This is a good example.  Importantly, it implements the serialization interface that is necessary for cut, copy, and paste, as well as undo and redo.

December 2004: MSDN Magazine, .NET Internals: Tailor Your Application by Building a Custom Forms Designer with .NET [article and code: CustomFormsDesigner.exe]

Now MSDN Magazine has published what I consider to be an authoritative article that clears up some of the confusion in the Dawson article.  This is essential info in understanding how the framework designer works and what needs to be provided by the programmer.  Highly recommended, even mandatory if you are trying to do this

A weakness of this entire process is that there is little documentation other than the articles on how everything is supposed to be glued together.  Each interface or supporting class has a basic description available, but little in the way of detailed interaction is explained.  The MSDN Magazine article lists some of the required services, but not all.  Here are some additional hints at completing a full-featured design surface.

This capability is highly dependent on implementing interfaces, and there are quite a few of those.  As stated in the referenced documents above, implementing one of these is not easy.  Here are links to some of those interfaces.

IComponent
IComponentChangeService
IContainer
IDesigner
IDesignerEventService
IDesignerFilter
IDesignerHost
IDesignerOptionService
IDesignerSerializationService
IDictionaryService
IExtenderListService
IExtenderProviderService
IMenuCommandService
INameCreationService
IRootDesigner
ISelectionService
IServiceContainer
IServiceProvider
ISite
IToolboxService
ITypeDescriptorFilterService
ITypeResolutionService

Print | posted on Tuesday, November 23, 2004 7:16 PM | Filed Under [ Programming ]

Feedback

Gravatar

# re: Implementing a Custom Forms Designer in .NET

Great job! Thank you very much. your work helps me a lot.
12/10/2004 5:15 PM | Bill
Gravatar

# re: Implementing a Custom Forms Designer in .NET

very nice, keep the good work!
1/21/2005 5:27 PM | Sam
Gravatar

# re: Implementing a Custom Forms Designer in .NET

You can download the SharpDevelop book for free now. It has a few chapters related to its form designer: http://www.apress.com/free/index.html
1/26/2005 11:43 PM | a
Gravatar

# re: Implementing a Custom Forms Designer in .NET

Has anybody sucseeded to get the (name) property working in the CustomFormsDesigner.exe example ??

Maybe someone could direct me on how to display it ??
7/9/2005 10:53 AM | Uwe
Gravatar

# re: Implementing a Custom Forms Designer in .NET

I am reserching the code ! Thank you for you helping ! It is hard to find the code on the Internet
7/13/2005 4:46 PM | jacky
Gravatar

# Inserting a 3rd Party ActiveX control

I would like to know if anyone has used all this to develop a Form Designer to insert any 3rd party ActiveX control in .NET with C#.
I'm actually trying to insert an Office Web Component (Spreadsheet) and it crashes!!
Thanks
11/30/2005 12:48 AM | Malu
Gravatar

# re: Implementing a Custom Forms Designer in .NET

i want to make a custom designer and i need to create xml source for design (no codedomserialization).

i see a sample but i need a step by step guide.

any one knows?
10/12/2006 3:15 AM | ceh
Gravatar

# re: Implementing a Custom Forms Designer in .NET

yeah, I would like one too!
7/5/2007 7:19 AM | mike
Gravatar

# re: Implementing a Custom Forms Designer in .NET

I would like to know how to integrate the custom designer to Visual Studio IDE rather than have as a seperate application.

Could any one help?
8/22/2007 9:00 AM | Dhrub
Gravatar

# re: Implementing a Custom Forms Designer in .NET

Has anybody sucseeded to get the (name) property working in the DesignerHost.exe example ??

Maybe someone could direct me on how to display it ?? Please help me ..
12/25/2007 11:54 PM | Prakash Diwakar
Gravatar

# re: Implementing a Custom Forms Designer in .NET

That sample don't work on .NET Framework 2.0 (set in config file only that version). I try drag some control in runtime - Piped error: NullReferenceException on DragAssistanceManager.Initialize
4/9/2008 5:01 AM | Igor
Gravatar

# re: Implementing a Custom Forms Designer in .NET

Can you tell us something about using IResourceService and Serializing/Deserializing with it extended properties and resources like Images.
4/27/2008 4:19 PM | Tomek
Gravatar

# re: Implementing a Custom Forms Designer in .NET

How can i persist a form in a file and reload this file to reedit?
thanks a lot.
10/11/2008 9:07 AM | QG
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: