小编Jan*_*ana的帖子

如何在Windows窗体C#中为文本框设置Scintilla

我有一个带有文本框的Windows窗体,用户可以在其中编写Python脚本.

我在表单中使用Scintilla,但我希望它的区域是一个文本框.有什么方法可以将Scintilla绑定到文本框吗?

以下是我尝试过的代码:

 this.scintilla2.ConfigurationManager.Language = "python";
 this.scintilla2.Dock = System.Windows.Forms.DockStyle.Fill;
 this.scintilla2.Location = new System.Drawing.Point(600, 430);
 this.scintilla2.Name = "scintilla2";
 this.scintilla2.TabIndex = 0;
 this.Controls.Add(this.scintilla2);
Run Code Online (Sandbox Code Playgroud)

.net c# scripting scintilla

5
推荐指数
1
解决办法
1186
查看次数

如何在C#中的每一行获取字符串内容

我有一个字符串,其中包含一个动态运行的小代码.但我想将每行字符串存储在单独的数据结构中,并计算行数.

string CodeStr = @"using System";

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(" Hello World");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

对于计数线:

        int count = 0;
        int position = 0;
        while ((position = CodeStr.IndexOf('\n', position)) != -1)
        {
            count++;
            position++;       
        }
Run Code Online (Sandbox Code Playgroud)

但我不知道如何获得每一行的内容,如

第1行:使用System;

第2行:命名空间ConsoleApplication2

第3行:{等等完整的字符串.

.net c# string

0
推荐指数
1
解决办法
299
查看次数

标签 统计

.net ×2

c# ×2

scintilla ×1

scripting ×1

string ×1