Geeks With Blogs

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

.NET Hobbyist Programmer Staying Confused in a Busy World

My previous post on a .NET custom forms designer was a basic listing of the samples that are out there and some of their merits.  It was not an exceptionally enlightened piece, so I intend to correct a few things and add some additional detail over the next couple of weeks.  I included a listing of interfaces and made an unfulfilled hint at completing a full-featured design surface.  I’ll get to the point eventually, so bear with me on this.  We are off on a voyage of discovery....

I listed five examples of design surfaces in that first post.  I will be throwing out two of them from consideration, but for different reasons.  The first to be tossed is the MSDN GDI+ sample.  This does not interact with the core .NET designer and is actually a poor substitute at trying to emulate it.  It is OK for what it tries to do, but it does not fit my ultimate goal, which I’ll get to shortly.

The second example to be tossed is SharpDevelop.  I am not trying to recreate Visual Studio as they are.  SharpDevelop also has what can only be called an intricate extensible structure of "codons".  Their extensibility structure seems to have created lots of additional work with little perceivable benefit.  Perhaps I’m wrong.  Anyway, you are welcome to look at their work, but the GPL restrictions were enough to turn me off.

That leaves us with three samples.  For ease of reference, I’ll shorten their names as follows:

From these three samples, I intend to work towards a Windows Forms design surface that I will be able to then customize for my specific application.  Therefore my goal is a rich design environment that will permit my users to create custom forms.  Eventually, I'll create some custom controls and restrict them to only using those, but that is far in the future.  In the meantime, I need to create a designer.

I need to make a few corrections to my earlier comments.

The Dawson sample consists of code and a brief accompanying article.  There is some depth to parts of the discussion, but it does not cover things in detail.  Overall, it is great and was the first published effort I found.  The presented sample is very rough, but it works.  The toolbox is actually a Listbox with the names of the controls.  There is simple functionality.

The MSDN sample is far ahead of the Dawson version.  Interestingly, I wondered if they came from the same code base, since there were some amazing similarities I saw.  The MSDN toolbox is a Treeview with drag-and-drop functionality.  Tools and icons are loaded from those installed on the user’s machine with the framework.  Functionality is much better.

The MSKB sample is actually the best of the three.  There is no real accompanying article, but the code is well-commented.  In fact, the code appears to have been excised from a larger, more-finished program.  There are several stubs present for additional interface implementations.  These may well be the remains of routines left after custom code was removed, but their retention is appreciated.  Many of the comments look suspiciously like the remains of XML comments that have had their XML wrappers deleted.  This sample has by far the best functionality.  Keyboard and menu commands are included.  Code display in both VB and C# is supported.  The toolbox looks much like Visual Studio’s and supports both mouse and keyboard.  Overall, it wins as the most complete example.

Posted on Thursday, January 6, 2005 9:29 PM Programming , Forms Designer | Back to top

Comments on this post: Custom Forms Designer: The Goal

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
Just in case you're not aware, the 2.0 framework includes all class implementations necessary to host designers. In fact, the Visual Studio 2005 designer uses the one built in to the framework, instantly giving you undo/redo and serialization support without having to write all the code these articles are about.
Left by Tim Dawson on Jan 09, 2005 6:46 PM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
Hi there

Thanks for your summary - very useful :-).
I'd also be interested in the process of code (de)serialization - how could I parse the source of winform and load it into a custom designer?

There are either no resources available on this or I'm searching for the wrong topics :-/. Any links on this?
Left by Philipp on Mar 24, 2005 1:42 PM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
Philipp: Take a look at the MSKB sample and trace through what happens when you click on File | Open. The SampleDesignerLoader.cs BeginLoad routine and its use of the SampleDesignerSerializationManager is what you are looking for.
Left by Mark on Mar 24, 2005 7:49 PM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
2Tim Dawson.

Would you give a link where you take an information about new features of Form Designer, DesignSurface and serialization/deserialization?
Left by Grenal on May 11, 2005 11:09 AM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
A JScript designer would be nice. JScript didn't have any.
Left by App on Jun 30, 2005 8:42 PM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
Hi Tim,

How's it going with the Designer for .NET 2.0. I have recently implemented a custom forms designer in Whidbey Beta2 but I'm having some problems with a) A CodeDom designerLoader and b) Serializing some .NET 2.0 controls.
Left by Graham Allwood on Aug 05, 2005 3:54 AM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
Hi there!,

Let me say that your blog'w page is very, very nice and absorbing. All documentation referenced in this article or blog is very useful, but... i have a question about the undo/redo feature in the designer host:

I know that the Framework 2.0 implements this commands easily... but i don't know how!!. Someone can gives me an example?.

Using GlobalInvoke(StandardCommands.Undo) doesn't works!.

Thank you a lot in advance!
Left by César F. Qüeb Montejo on Jan 17, 2006 4:47 PM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
Never in mind!

I have found the solution to my previous request. Anyway..., i assume that this page never was readed!!

Left by César F. Qüeb Montejo on Jan 30, 2006 8:02 AM

# re: .NET Custom Forms Designer: The Goal
Requesting Gravatar...
How SnapToGrid works? I downloaded the code and try to run it from Microsoft site everything works execep SnapToGrid and ShowGrid, can anyone help me with this.
Left by ashokbaria on Jul 16, 2007 12:00 PM

# re: Custom Forms Designer: The Goal
Requesting Gravatar...
Take a look at this sample for implementing a snap-to-grid feature...

Hope it helps.
Left by Claudio Lins on Nov 01, 2007 12:29 PM

# re: Custom Forms Designer: The Goal
Requesting Gravatar...

I found your useful blog whilst investigating windows forms designers and macro/script hosting.

I didnt have the link to the MSKB article you have here but after downloading it seems to be a similar to an article by Dinesh, the code seems to be from the same base. the article is here and the application seems to be a little more structured and includes a solution exporer and a command output window but most importantly there is also an article to accompany it. hope this is a useful update to your blog.


Left by Pete Finnigan on Mar 01, 2011 11:06 AM

Your comment:
 (will show your gravatar)

Copyright © Mark Treadwell | Powered by: