从ScintillaNet打印内容时打印行号

时间:2018-12-21 20:35:49

标签: c# printing line-numbers scintilla scintillanet

我正在尝试使用ScintillaNET创建一个IDE,并且正在使用ScintillaNet作为编辑器,当我打印文本时,有没有办法获取ScintillaNet附带的行号?

1 个答案:

答案 0 :(得分:1)

ScintillaNet控件具有以下property

if($user->wasRecentlyCreated){
    return whatever you need if it is a new user 
}
else{
   return user was already in the database
}

您可以通过以下方式迭代此集合并添加行号:

public LineCollection Lines { get; }

如果使用以下文本设置控件:

using System.Windows.Forms;
using ScintillaNET;

string _s=""; //The string where you will get the results
foreach (Line _l in scintilla1.Lines) //scintilla1 is the name of your ScintillaNet control
//Line is a class that represents an individual line of text and has several properties
{
    _s += "Line " + (_l.Index + 1).ToString() + ": " + _l.Text; 
}
MessageBox.Show(_s);

您将得到以下结果:

enter image description here