Search code examples
c#winformsrichtextboxrtf

C# richTextBox spacing issue?


I am writting a client for a chat server program I wrote that uses a richTextBox control to display user text. Everything works except some ASCII art that I am using for my servers motd. When running it my text is displayed like this. As you can see there appears to be something wrong with the spacing. enter image description here

Now if I type this up in notepad using the exact same font I get this. Why isn't the richTextBox displaying the same result? I am really confused here.....

enter image description here

Edit: The problem is due to the RTF sent by the server. How can I add an extra space in RTF?


Solution

  • Apparently, the problem originates from the way you feed the RichTextBox control with your ASCII art text. By examining both images, you can see that the missing characters in your RichTextBox are backslashes and the characters after backslashes. It seems that you forgot to escape the backslash character.