C# - 完美的语法高亮语法、完美、高亮

2023-09-02 10:55:43 作者:草莓兔报社

我在找语法高亮一个RichTextBox! 听起来很容易,但我在寻找,因为个月,并没有发现我所需要的。

I'm looking for a RichTextBox with syntax highlighting! Sounds easy but I'm searching since months and didn't find that what I need.

首先我开始自己做...没有好主意......

First I started to do it by myself... No good idea...

我试图用这样的: http://blogs.microsoft.co.il/blogs/tamir/archive/2006/12/14/RichTextBox-syntax-highlighting.aspx

但code不处理加载文件或粘贴,所以我开始写的一大亮点功能,插入文本块。该教程和我的code工作得很好,但后来我看到了很多微小的错误和装载大文件花了太多的时间。

but that code don't handle loading files or pasting so i started to write a highlight function for inserting text-blocks. That tutorial and my code worked fine first, but then I saw a lot of tiny bugs and loading large files took too much time.

然后,发现了很多类似的教程/ codeS为codeproject.com是这样的: http://www.$c$cproject.com/KB/edit/SyntaxHighlighting.aspx

Then a found a lot of similar tutorials/codes at codeproject.com like this: http://www.codeproject.com/KB/edit/SyntaxHighlighting.aspx

不过,我得到的问题,如果该文件变大了。粘贴和加载文件将需要一段时间...

But there I get problems if the file becomes large, too. Pasting and loading files will take a while...

我想我在寻找这样的事情: http://www.aqistar.com/

I think I'm searching for something like this: http://www.aqistar.com/

但我不能够花的钱,我想卖掉我的计划可能因此code /控制应该是免费的。

But I don't can spent money and I want to sell my program maybe so the code/control should be free.

任何人可以帮助我吗?

推荐答案

AvalonEdit 是使用基于WPF的文本编辑器在 SharpDevelop的的4.0。它内置的语法高亮几种语言,你可以使用基于XML的文件格式,添加新的高亮定义的支持。

AvalonEdit is the WPF-based text editor used in SharpDevelop 4.0. It has built-in support for syntax highlighting for several languages and you can add new highlighting definitions using an XML-based file format.

AvalonEdit是开源的,但也可以在商业应用(LGPL)。使用

AvalonEdit is open-source, but can also be used in commercial applications (LGPL).

如果你不想使用WPF,你也可以使用ICSharp code.TextEditor,旧的Windows窗体从SharpDevelop的3.x的文本编辑器。

If you don't want to use WPF, you could also use ICSharpCode.TextEditor, the old Windows Forms text editor from SharpDevelop 3.x.