ICSharpCode.TextEditor使用及扩展


SharpDevelop (#develop)有很多“副产品”,其中最出名的应算SharpZipLib (#ziplib),纯C#的ZIP类库,而在SharpDevelop (#develop)中,“隐藏”了很多优秀的类库,其中ICSharpCode.TextEditor是表表者。

ICSharpCode.TextEditor源代码隐匿在\SharpDevelop\src\Libraries\ICSharpCode.TextEditor中,可以利用SharpDevelop (#develop)打开ICSharpCode.TextEditor.cmbx,也可以看看其例子(\SharpDevelop\samples\SharpPad中)SharpPad.cmbx。

先说说它的用法:

1:将ICSharpCode.TextEditor.dll添加到工具箱中,然后拖到界面上。

2:设置如下属性(例):

复制代码
textEditorControl1.ShowEOLMarkers = false;
textEditorControl1.ShowHRuler = false;
textEditorControl1.ShowInvalidLines = false;
textEditorControl1.ShowMatchingBracket = true;
textEditorControl1.ShowSpaces = false;
textEditorControl1.ShowTabs = false;
textEditorControl1.ShowVRuler = false;
textEditorControl1.AllowCaretBeyondEOL = false;
textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("HTML");
textEditorControl1.Encoding = Encoding.GetEncoding("GB2312");
复制代码
3:指定内容文本
textEditorControl1.Text = "Hello World!"

 

再来说说他的扩展:

 官方原版的是不支持T-SQL语法的,我们让他支持T-SQL语法

下载http://files.cnblogs.com/wudingfeng/ICSharpCode.TextEditor_V3.0.rar

里面有一个TSQL-Mode.xshd文件,作为资源添加到项目中,然后修改SyntaxModes.xml文件,添加一行

 

<Mode file = "TSQL-Mode.xshd"
        name = "TSQL"
        extensions = ".sql"/>

然后再编译整个项目即可生成支持T-SQL的ICSharpCode.TextEditor.

 

下载最新SharpDevelop

 http://www.icsharpcode.com/OpenSource/SD/Download/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM