I am running into problems when trying to add new line using RichTextBox but not with Plane text. I have tested it in Rhino 7 (SR37) and Rhino 8 (SR17)
TextEntity text = new TextEntity();
RichTextBox rtb = new RichTextBox();
rtb.AppendText("Word\nWord\nWord\nWord");
text.RichText = rtb.Rtf; // All becomes one line without new line
text.PlainText = "Word\nWord\nWord\nWord"; // Works correctly
Rich Text has a different set of rules. I believe \par is the proper way to do a new line but I could be wrong. For example rtb.Rtf = @"{\rtf1\ansi Word\par word}"; should do the trick.
rtb = new RichTextBox();
rtb.AppendText("Word\nWord");
string s = rtb.Rtf;
If I Print rtb.Rtf then i will see: "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs17 Word\\par\r\nWord\\par\r\n}\r\n"
It seems still that is TextEntry problem not RichTextBox one
RichTextBox rtb = new RichTextBox();
rtb.Rtf = @"{\rtf1\ansi Word\par word}";
TextEntity text = new TextEntity();
text.RichText = rtb.Rtf;
text.Plane = new Plane(new Point3d(0, 0, 0), new Vector3d(0, 0, 1));
doc.Objects.AddText(text); // One line
Form form = new Form
{
Text = "RichTextBox",
Width = 400,
Height = 300
};
form.Controls.Add(rtb); // Two line
form.ShowDialog();