c#的richtextbox左对齐、右对齐、居中(段落对齐)

1.左对齐
private void 左对齐ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionAlignment=HorizontalAlignment.Left;
            //richtextbox选中段落的对齐方式=左对齐
        }
``

2.右对齐

 private void 右对齐ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            richTextBox1.SelectionAlignment = HorizontalAlignment.Right;
        }

3.居中

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


版权声明:本文为weixin_44575911原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。