我的表单上有一个RichTextBox控件。该控件的设置方式是,在输入32行文本后,它将换行到下一行。我遇到的问题是,我希望能够检索表示我控制的行的字符串数组。我知道RichTextBox附带了一个Lines属性,但我遇到了两个问题:
1) 我只想要一个字符串数组,显示仅在屏幕上可见的行。现在Lines数组返回RichTextBox中的每一行。我只想返回屏幕上可见的行。
2) The Lines property is not giving me a true representation of my lines. It counts a "line" as a line of text ended by a carriage return or . So in other words, if I type 64 characters and none of them are a carriage return, then it should return 2 lines (because there are 32 characters per line). Instead, it doesn t return any lines until I hit enter. Even then, it only returns 1 line, not 2. Its acting more like a Paragraph property, if there was such a thing.
有人知道解决这两个问题的方法吗?我正在使用C#btw