A textbox/richtextbox that has syntax highlighting? [C#] [closed]

两盒软妹~` 提交于 2019-11-26 08:04:43

问题


Where can I find a control for WinForms that will highlight source code pasted into it? I would like one that has syntax highlighting support for many different languages but if it only works with C# I would be fine with that also.


回答1:


Scintilla.NET is probably what you're looking for




回答2:


Just recently have found a nice control from codeproject Fast Colored TextBox for syntax highlighting.

The only issue with using Rich Text Box as highlighter is slow performance on coloring, in cases when the size of the document is big. For a medium size documents this issue can be fixed by delayed highlighting.




回答3:


As Open Source alternatives, give a look to:

  • dotNetFireball
  • ICSharpCode.TextEditor from SharpDevelop



回答4:


Add ICSharpCode.TextEditor assembly reference to a project, choose assembly and controls for Visual Studio Toolbox. After that, you can put control to the Form. Surprisingly, you will not see Property to choose syntax highlight schema. Instead of this, you have to use method SetHighlighting. String parameter sets highlighting schema from available schemas list. These schemas are embedded into the control.

How to use, change schemas and download sample, look following article




回答5:


If you're willing to pay for a control, I highly recommend this one: QWhale Syntax Edit. It's got a ton of features, comes with source code, and supports a lot of languages. I use it myself for C#, VB.NET, SQL (MS & Oracle), and it's got everything that VS provides.




回答6:


Check out the AvalonEdit control. There is a good article on CodeProject explaining how to use it.




回答7:


Not sure if there is any out of the box non-thirdparty solution to this.

But, have you looked at Actipro SyntaxEditor component. LinqPad, the ubercool linq tool uses it for syntax highlighting and intellisense.




回答8:


you can try this http://www.codeproject.com/KB/edit/SyntaxHighlighting.aspx



来源:https://stackoverflow.com/questions/1087735/a-textbox-richtextbox-that-has-syntax-highlighting-c

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