Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テキスト行 (各行は段落) を含む RichTextBox があり、エラーを表す行番号があります。その行の先頭にキャレットを設定したい。どのように?
現時点では、自分のマシンに C# がインストールされていませんが、ドキュメントを見ると、必要な段落を最初に見つけることができるはずです (おそらくそれらを列挙することによって、インデックス関数) でyourFlowDocument.Blocks、次に:
yourFlowDocument.Blocks
TextPointer paragraphStart = paragraph.ElementStart; richTextBox.CaretPosition = paragraphStart;