TimeGIS
InfoVista.NET
首页             技术文章             专业软件             管理软件             开源软件             知识分享             网站地图            

 程序设计

      C++
      C#
      Web
      GIS

 软件工程

      软件框架
      设计模式
      建模仿真

 计算机科学

      HelloWorld
      Jolt图书奖
      开源获奖
      图灵奖


Implementing a Custom Forms Designer in .NET

参考:http://geekswithblogs.net/mtreadwell/archive/2004/11/23/15763.aspx

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


共7页  第7页  首页  上一页  下一页  尾页


友情链接 尚禹水利环境 | 我行我速 | SharpDevelop | CSLA.NET | CodePlex | 开源中国社区 | 流体中文网 | 水资讯网 | 上帝之眼 FindSim.NET |
本网页由快手工具软件自动生成,感兴趣者请联系我们。