Geeks With Blogs

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

.NET Hobbyist Programmer Staying Confused in a Busy World

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

Posted on Tuesday, November 23, 2004 7:16 PM Programming | Back to top


Comments on this post: Implementing a Custom Forms Designer in .NET

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
Great job! Thank you very much. your work helps me a lot.
Left by Bill on Dec 10, 2004 5:15 PM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
very nice, keep the good work!
Left by Sam on Jan 21, 2005 5:27 PM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
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
Left by a on Jan 26, 2005 11:43 PM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
Has anybody sucseeded to get the (name) property working in the CustomFormsDesigner.exe example ??

Maybe someone could direct me on how to display it ??
Left by Uwe on Jul 09, 2005 10:53 AM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
I am reserching the code ! Thank you for you helping ! It is hard to find the code on the Internet
Left by jacky on Jul 13, 2005 4:46 PM

# Inserting a 3rd Party ActiveX control
Requesting Gravatar...
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
Left by Malu on Nov 30, 2005 12:48 AM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
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?
Left by ceh on Oct 12, 2006 3:15 AM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
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?
Left by Dhrub on Aug 22, 2007 9:00 AM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
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 ..
Left by Prakash Diwakar on Dec 25, 2007 11:54 PM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
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
Left by Igor on Apr 09, 2008 5:01 AM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
Can you tell us something about using IResourceService and Serializing/Deserializing with it extended properties and resources like Images.
Left by Tomek on Apr 27, 2008 4:19 PM

# re: Implementing a Custom Forms Designer in .NET
Requesting Gravatar...
How can i persist a form in a file and reload this file to reedit?
thanks a lot.
Left by QG on Oct 11, 2008 9:07 AM

Your comment:
 (will show your gravatar)


Copyright © Mark Treadwell | Powered by: GeeksWithBlogs.net