爱上语法高亮控件ICSharpCode.TextEditor ~o~

   语法高亮控件ICSharpCode.TextEditor来自开源项目SharpDevelop,今天才知道,汗!害我白白花费时间自己编了一个SyntaxTextBox(http://surfsky.cnblogs.com/archive/2005/12/12/295814.html)。不妨发挥拿来主义风格,解剖了它再说!科学研究发现,咳咳,这个控件比较牛了啦~。VisualStudio代码编辑器的功能基本都能实现(包括CodeComplete和tip功能),速度也很快,而且是--开源免费软件!(大家鼓掌:) ,我想我爱上它了^_^,在此严重推荐一下!


    1。以下是该控件的源代码和自己草编的简单使用例程:
    ICSharpCode.TextEditor1.1的源代码:【下载
    ICSharpCode.TextEditor2.2的源代码:【下载
    ICSharpCode.TextEditor3.2的dll:【下载 】
   自己编的使用例程:【下载
    注:sharpdevelop从4.0起就用wpf作为界面方案了,对应的代码编辑器是“AvalonEditor”。


   
    2。使用效果:
   
  
    3。使用该控件的关键句子:

        using ICSharpCode.TextEditor;
        
using ICSharpCode.TextEditor.Gui.CompletionWindow;
        
using ICSharpCode.TextEditor.Document;
        
using ICSharpCode.TextEditor.Actions;
    
        
protected  ICSharpCode.TextEditor.TextEditorControl txtContent;

        txtContent.Document.HighlightingStrategy 
= HighlightingStrategyFactory.CreateHighlightingStrategy("C#");
        txtContent.Encoding 
= System.Text.Encoding.Default;

        这几句代码若是不写的话,会无法高亮显示代码且汉字会变乱码的。切记切记,阿弥陀佛~

        欢迎大家讨论该控件的使用方法~~

转载请注明出处:http://surfsky.cnblogs.com 

原文地址:https://www.cnblogs.com/surfsky/p/308517.html