在richTextBox中添加行号:

richTextBox的名称为:txtContent代码如下:

 

private void menuItem1_Click(object sender, System.EventArgs e)
  {
   int n=1;string data="";
   foreach (string s in txtContent.Lines)
   {
    data+=n.ToString() + "  " + s + "\r\n";
    n++;
   }
   txtContent.Text=data;
  }

如果要取消行号怎么做捏?

欢迎广大编程爱好者帮帮我出思路!

相关文章:

  • 2021-05-21
  • 2021-12-14
  • 2022-12-23
  • 2021-07-06
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2021-11-23
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案