开发神器 SharpDevelop 的插件系统,很有学习的必要。

1.首先在 github 上下载源代码,确保编译运行无误。

2.在 AddIns/Misc 下添加 SharpDevelop 插件项目 x01.TestViewContent,然后添加 ICSharpCode.Core 和 ICSharpCode.SharpDevelop 引用,设置这两个引用的 Local Copy 为 false;在项目属性上选编译输出为  “..\..\..\..\AddIns\AddIns\Misc\TestViewContent\”,可参考其他插件。设置 TestViewContent.addin 的文件属性 Local copy 为 Always。

3.添加类 TestViewContent.cs, 内容如下:

 1 /**
 2  * TestViewContent.cs (c) 2015 by x01
 3  */
 4 using System;
 5 using System.Windows.Forms;
 6 using ICSharpCode.SharpDevelop.Gui;
 7 
 8 namespace x01.TestViewContent
 9 {
10     /// <summary>
11     /// Description of TestViewContent.
12     /// </summary>
13     public class TestViewContent : AbstractViewContent
14     {
15         Control control;        
16         
17         public override Control Control {
18             get {
19                 return control;
20             }
21         }
22         
23         public TestViewContent() : base("Test")
24         {
25             Panel panel = new Panel();
26             panel.Dock = DockStyle.Fill;
27             
28             TextBox textbox = new TextBox();
29             textbox.Text = "Hello world!";
30             textbox.Dock = DockStyle.Fill;
31             textbox.Multiline = true;
32             textbox.Height = 500;
33             
34             panel.Controls.Add(textbox);
35             
36             this.control = panel;
37         }
38     }
39 }
TestViewContent

相关文章: