在不使用fastcoloredtexbox的情况下在richtextbox中进行代码折叠 [英] Code folding in richtextbox without using fastcoloredtexbox

查看:130
本文介绍了在不使用fastcoloredtexbox的情况下在richtextbox中进行代码折叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在字符串中格式化了json代码和xml代码,我希望在不使用fastcoloredtextbox的情况下在我的Windows应用程序中显示。我使用下面的代码,但它不起作用。



我尝试过:



  var  sectionPositions = 
FoldFinder.Instance.Find(code, new 列表< sectiondelimiter>(
new SectionDelimiter [ 2 ] {
new SectionDelimiter(){Start = \\ {,结束= \\}},
new SectionDelimiter(){Start = (?< = \\ [| \\ {|; | ^)[^ [{;] *(?=;),结束= ;},
}));

解决方案
您可以将语言设置为XML,如下所示:

 fctb1.Language = Language.XML; 



可用的语言是:

公共枚举语言
{
自定义,
CSharp,
VB,
HTML,
XML,
SQL,
PHP,
JS,
Lua
}


I have formatted json code and xml code in string, i want to display in my windows application without using fastcoloredtextbox. i used below code but it doesn't work.

What I have tried:

var sectionPositions =
FoldFinder.Instance.Find(code, new List<sectiondelimiter>(
  new SectionDelimiter[2] {
            new SectionDelimiter() { Start = "\\{", End = "\\}" },
            new SectionDelimiter() { Start = "(?<=\\[|\\{|;|^)[^[{;]*(?=;)", End = ";" },
  }));

解决方案

You can set the language to XML as follows:

fctb1.Language = Language.XML;


The available languages are:

public enum Language
{
    Custom,
    CSharp,
    VB,
    HTML,
    XML,
    SQL,
    PHP,
    JS,
    Lua
}


这篇关于在不使用fastcoloredtexbox的情况下在richtextbox中进行代码折叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆