private void UpdateRichTextBox() { int maxLine = Math.Min(ScrolledLine + FVisibleLines, FRTFSelectionList.Count); var rtfBuilder = new StringBuilder(CRTFHeader); for (int i = ScrolledLine; i < maxLine; i++) { rtfBuilder.Append(FRTFSelectionList[i]); } //seems mono adds a \par here automatically, so remove one string rtf = rtfBuilder.ToString(); rtf = rtf.TrimEnd(new char[5] { '\\', 'p', 'a', 'r', ' ' }); // + "}"; if (FRichTextBox.InvokeRequired) { FRichTextBox.Invoke(new MethodInvoker(() => { FRichTextBox.Rtf = rtf; })); } else { FRichTextBox.Rtf = rtf; } FNodeTypePanel.Invalidate(); }