RichTextBox中字符的长度的问题
在richTextBox2中显示的字符要右对齐
private void button7_Click(object sender, EventArgs e)
{
string str = "iii ";
this.richTextBox2.AppendText(str.PadLeft(10) + "\n ");
str = "MMM ";
this.richTextBox2.AppendText(str.PadLeft(10) + "\n ");
str = "lll ";
this.richTextBox2.AppendText(str.PadLeft(10) + "\n ");
}
当RichTextBox的字体是SimSun时显示正确,当RichTextBox的字体是Arial时显示就不正确了,请问当字体为Arial时该如何做?
------解决方案--------------------统一设置Align属性不可以吗
richTextBox2.SelectionAlignment = HorizontalAlignment.Right;
------解决方案--------------------一些字体的M,L宽度不一样
但RichTextBox本身就每一行可以左中右对齐
richTextBox1.SelectionAlignment = HorizontalAlignment.Right;