ICSharpCode.TextEditor使用及扩展

摘要:
首先,让我们谈谈它的用法:1:将ICSharpCode.TextEditor.dll添加到工具箱中,然后将其拖到接口中。

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语法

下载https://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/

免责声明:文章转载自《ICSharpCode.TextEditor使用及扩展》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C#获取当前应用程序所在路径及环境变量C# 共享内存(转)下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章