【发布时间】:2010-09-07 16:39:27
【问题描述】:
我正在寻找一个支持语法高亮、代码折叠等的优质 WinForms 组件。关键标准是:
- 稳定性
- 价值(价格)
- 能够轻松自定义语法以突出显示
- 重量轻
【问题讨论】:
标签: .net winforms components
我正在寻找一个支持语法高亮、代码折叠等的优质 WinForms 组件。关键标准是:
【问题讨论】:
标签: .net winforms components
ICSharpCode.TextEditor 是免费且相当稳定的。
至于商业解决方案,Actipro 的SyntaxEditor 可能是最好的选择
【讨论】:
试试ScintillaNET,它是一个围绕优秀Scintilla 控件的.NET WinForms 包装器。 Scintilla 本身是一个免费的源代码编辑器组件,它非常可定制,并具有您要求的所有功能。截图见here。
【讨论】:
与 Scintilla.Net 相比,增强 ICSharpCode.TextEditor 是微不足道的。 ICSharpCode.TextEditor 的另一个巨大好处是允许您自定义/构建自己的语法突出显示,例如:https://github.com/icsharpcode/SharpDevelop/wiki/Syntax-highlighting。
但是 ICSharpCode.TextEditor 不稳定,它充斥着 AccessViolations:https://www.google.com.au/search?q=icsharpcode.texteditor+accessviolationexception
您可以通过下载直接查看这些 AccessViolations: http://www.codeproject.com/Articles/30936/Using-ICSharpCode-TextEditor
GitHub 上的这个构建在 winforms 中表现更好,但在 VSTO 中它仍然尖叫 AccessViolations: https://github.com/KindDragon/ICSharpCode.TextEditor
同DigitalRune's version of the ICsharp.TextEditor。
我推荐最新的 WPF 实现:ICSharp.AvalonEdit。
如果您需要在 Winforms 中托管此 WPF 控件:
public Form1()
{
InitializeComponent();
ICSharpCode.AvalonEdit.TextEditor te = new ICSharpCode.AvalonEdit.TextEditor();
ElementHost host = new ElementHost();
host.Size = new Size(200, 100);
host.Location = new Point(100, 100);
host.Child = te;
this.Controls.Add(host);
}
【讨论】: