Warm tip: This article is reproduced from serverfault.com, please click

How to 'align' text in RichTextBox C#?

发布于 2011-06-05 13:54:23

How do I align the text in a RichTextBox?

RTB

Basically, the RTB contains:

"--testing"

"--TESTING"

"TESTING--"

"testing--"

Which all have the same number of characters, but have different alignments. How can I align them properly? Im fairly new to C# and confused since it aligned properly in Java's TextArea.

Thank you!

Questioner
user488792
Viewed
0
Fosco 2011-06-05 22:09:43

You would have to change the font to a monospaced font, like Courier. This behavior you're showing is standard with most fonts, as not all characters are the same width.