设置RichTextBox控件的文本的对齐方式

实现效果:

  

知识运用:

  RichTextBox控件的SelectionAlignment属性  //获取或设置在当前选择或插入点的对齐方式

  public HorizontalAlignment SelectionAlignment{get;set;}  //参数:枚举值之一

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionAlignment = HorizontalAlignment.Left;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionAlignment = HorizontalAlignment.Right;
        }
原文地址:https://www.cnblogs.com/feiyucha/p/10159167.html