0

我有一个包含文本行(每行一个段落)的 RichTextBox,并且我有一个表示错误的行号。我想将插入符号设置在该行的开头。如何?

4

1 回答 1

2

I haven't got a working installation of C# on my machine at the moment, but from looking at the docs it seems you should be able to first locate the paragraph you want (probably by enumerating through them, there does not seem to be an index function) in yourFlowDocument.Blocks and then:

TextPointer paragraphStart = paragraph.ElementStart;
richTextBox.CaretPosition = paragraphStart;
于 2013-06-28T13:12:15.037 回答