SharpDevelop 笔记

1. 下载地址: http://jaist.dl.sourceforge.net/project/sharpdevelop/

2. 使用 VS2012 去掉编译不通过的 Test ,其它可以运行调试。

3. 入口: http://www.cnblogs.com/taxhaven/articles/1725186.html

4. 它的窗体设计器果然使用的是 微软开发的窗体设计器:

  事件绑定在: SharpDevelop_4.3.1.9430_Source\src\Main\Base\Project\Src\Gui\Workbench\Layouts\AvalonWorkbenchWindow.cs

    

    viewTabControl.SelectionChanged += delegate {
         UpdateActiveViewContent();
      };

之后会执行:SharpDevelop_4.3.1.9430_Source\src\AddIns\DisplayBindings\FormsDesigner\Project\Src\DesignerViewContent.cs
  

  

 1         void LoadDesigner()
 2         {
 3             LoggingService.Info("Form Designer: BEGIN INITIALIZE");
 4             
 5             DefaultServiceContainer serviceContainer = new DefaultServiceContainer();
 6             serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService());
 7             serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService);
 8             
 9             serviceContainer.AddService(typeof(IHelpService), new HelpService());
10             serviceContainer.AddService(typeof(System.Drawing.Design.IPropertyValueUIService), new PropertyValueUIService());
11             
12             serviceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), new DesignerResourceService(this.resourceStore));
13             AmbientProperties ambientProperties = new AmbientProperties();
14             serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);
15             this.typeResolutionService = new TypeResolutionService(this.PrimaryFileName);
16             serviceContainer.AddService(typeof(ITypeResolutionService), this.typeResolutionService);
17             serviceContainer.AddService(typeof(DesignerOptionService), new SharpDevelopDesignerOptionService());
18             serviceContainer.AddService(typeof(ITypeDiscoveryService), new TypeDiscoveryService());
19             serviceContainer.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService());
20             serviceContainer.AddService(typeof(ProjectResourceService), CreateProjectResourceService());
21             
22             // Provide the ImageResourceEditor for all Image and Icon properties
23             this.addedTypeDescriptionProviders.Add(typeof(Image), TypeDescriptor.AddAttributes(typeof(Image), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor))));
24             this.addedTypeDescriptionProviders.Add(typeof(Icon), TypeDescriptor.AddAttributes(typeof(Icon), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor))));
25             
26             if (generator.CodeDomProvider != null) {
27                 serviceContainer.AddService(typeof(System.CodeDom.Compiler.CodeDomProvider), generator.CodeDomProvider);
28             }
29             
30             designSurface = CreateDesignSurface(serviceContainer);
31             designSurface.Loading += this.DesignerLoading;
32             designSurface.Loaded += this.DesignerLoaded;
33             designSurface.Flushed += this.DesignerFlushed;
34             designSurface.Unloading += this.DesignerUnloading;
35             
36             serviceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), new ICSharpCode.FormsDesigner.Services.MenuCommandService(this, designSurface));
37             ICSharpCode.FormsDesigner.Services.EventBindingService eventBindingService = new ICSharpCode.FormsDesigner.Services.EventBindingService(this, designSurface);
38             serviceContainer.AddService(typeof(System.ComponentModel.Design.IEventBindingService), eventBindingService);
39             
40             this.loader = loaderProvider.CreateLoader(generator);
41             designSurface.BeginLoad(this.loader);
42             
43             if (!designSurface.IsLoaded) {
44                 throw new FormsDesignerLoadException(FormatLoadErrors(designSurface));
45             }
46             
47             undoEngine = new FormsDesignerUndoEngine(Host);
48             serviceContainer.AddService(typeof(UndoEngine), undoEngine);
49             
50             IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService));
51             componentChangeService.ComponentChanged += ComponentChanged;
52             componentChangeService.ComponentAdded   += ComponentListChanged;
53             componentChangeService.ComponentRemoved += ComponentListChanged;
54             componentChangeService.ComponentRename  += ComponentListChanged;
55             this.Host.TransactionClosed += TransactionClose;
56             
57             ISelectionService selectionService = (ISelectionService)designSurface.GetService(typeof(ISelectionService));
58             selectionService.SelectionChanged  += SelectionChangedHandler;
59             
60             if (IsTabOrderMode) { // fixes SD2-1015
61                 tabOrderMode = false; // let ShowTabOrder call the designer command again
62                 ShowTabOrder();
63             }
64             
65             UpdatePropertyPad();
66             
67             hasUnmergedChanges = false;
68             
69             LoggingService.Info("Form Designer: END INITIALIZE");
70         }
View Code

如果我们添加自定义控件,需要捕获鼠标拖动控件放到窗体上完成之后的事件。

 

posted @ 2013-10-09 22:03  NewSea  阅读(872)  评论(0编辑  收藏  举报