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

实现效果:

  设置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;
}
上一篇:shell脚本-正则、grep、sed、awk


下一篇:weak属性需要在dealloc中置nil么?