【问题标题】:How do I create a new line in TextBox whenever it starts a new row in C#?每当在 C# 中开始新行时,如何在 TextBox 中创建新行?
【发布时间】:2015-02-19 05:40:38
【问题描述】:

我想从 TextBox 中显示的文本中获取特定行(也可以是 RichTextBox,这并不重要),但是 TextBox.Lines 方法仅在内部有“Enter”时才识别新行文本。

我的文本是连续的,但 TextBox 一次删除一行,用完同一行。是否可以通过长度从文本框中获取特定行?

【问题讨论】:

    标签: c# textbox line lines string-length


    【解决方案1】:

    在文本框中自动换行后,您可以使用此功能:

    textBox1.GetFirstCharIndexFromLine(line);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-29
      • 2013-05-25
      • 2014-02-12
      • 2022-01-13
      • 1970-01-01
      • 1970-01-01
      • 2011-08-11
      • 2014-03-19
      相关资源
      最近更新 更多