c# - perfect syntax highlighting [closed]

試著忘記壹切 提交于 2019-11-30 11:31:02

问题


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...

I tried to use this: http://blogs.microsoft.co.il/blogs/tamir/archive/2006/12/14/RichTextBox-syntax-highlighting.aspx

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.

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...

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

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

Can anybody help me?


回答1:


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 is open-source, but can also be used in commercial applications (LGPL).

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




回答2:


Give a look to these open source projects:

  • ScintillaNET
  • dotNetFireball


来源:https://stackoverflow.com/questions/1383574/c-sharp-perfect-syntax-highlighting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!