• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Kevin Cheng's Yard
电脑是我的老婆,编程是我的灵魂,代码是我的语言,按键是我在歌唱。
https://github.com/surfsky/
博客园    首页    新随笔    联系   管理    订阅  订阅

爱上语法高亮控件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 

posted @ 2005-12-30 21:21  surfsky  阅读(8205)  评论(18)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3