有语法高亮显示的文本框/richtextbox ?(c#)

时间:2021-08-14 16:05:57

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.

我在哪里可以找到WinForms的控件来突出粘贴到其中的源代码?我想要一个对许多不同语言都有语法突出显示支持的语言,但是如果它只支持c#,我也可以接受。

8 个解决方案

#1


31  

Scintilla.NET is probably what you're looking for

闪烁。NET可能就是你要找的

#2


12  

As Open Source alternatives, give a look to:

作为开放源码的替代品,请看以下内容:

#3


12  

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

最近刚刚从codeproject快速彩色文本框中找到了一个不错的控件,用于语法高亮显示。

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.

使用富文本框作为highlighter的唯一问题是,在文档大小较大的情况下,上色的表现较慢。对于中等大小的文档,可以通过延迟突出显示来解决这个问题。

#4


8  

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.

添加ICSharpCode。TextEditor程序集引用项目,选择Visual Studio工具箱的程序集和控件。之后,您可以将控件放到窗体中。令人惊讶的是,您将看不到选择语法突出显示模式的属性。相反,你必须使用se大腿照明的方法。字符串参数设置突出显示可用模式列表中的模式。这些模式被嵌入到控件中。

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

如何使用、更改模式和下载示例,请参阅下面的文章

#5


4  

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.

如果您愿意为控件付费,我强烈推荐这个控件:QWhale语法编辑。它有很多特性,带有源代码,并且支持很多语言。我自己用它来表示c# VB。NET, SQL (MS & Oracle),还有VS提供的所有东西。

#6


3  

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

查看AvalonEdit控件。有一篇关于CodeProject的好文章解释如何使用它。

#7


1  

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.

但是,您看过Actipro SyntaxEditor组件了吗?LinqPad是ubercool linq工具,它用于语法高亮显示和智能感知。

#8


1  

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

您可以尝试http://www.codeproject.com/kb/edit/syntaxhighlight.aspx

#1


31  

Scintilla.NET is probably what you're looking for

闪烁。NET可能就是你要找的

#2


12  

As Open Source alternatives, give a look to:

作为开放源码的替代品,请看以下内容:

#3


12  

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

最近刚刚从codeproject快速彩色文本框中找到了一个不错的控件,用于语法高亮显示。

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.

使用富文本框作为highlighter的唯一问题是,在文档大小较大的情况下,上色的表现较慢。对于中等大小的文档,可以通过延迟突出显示来解决这个问题。

#4


8  

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.

添加ICSharpCode。TextEditor程序集引用项目,选择Visual Studio工具箱的程序集和控件。之后,您可以将控件放到窗体中。令人惊讶的是,您将看不到选择语法突出显示模式的属性。相反,你必须使用se大腿照明的方法。字符串参数设置突出显示可用模式列表中的模式。这些模式被嵌入到控件中。

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

如何使用、更改模式和下载示例,请参阅下面的文章

#5


4  

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.

如果您愿意为控件付费,我强烈推荐这个控件:QWhale语法编辑。它有很多特性,带有源代码,并且支持很多语言。我自己用它来表示c# VB。NET, SQL (MS & Oracle),还有VS提供的所有东西。

#6


3  

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

查看AvalonEdit控件。有一篇关于CodeProject的好文章解释如何使用它。

#7


1  

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.

但是,您看过Actipro SyntaxEditor组件了吗?LinqPad是ubercool linq工具,它用于语法高亮显示和智能感知。

#8


1  

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

您可以尝试http://www.codeproject.com/kb/edit/syntaxhighlight.aspx