1 字体
            Font font1 = new Font("宋体", 18);
             richTextBox1.Font = font1;
             Font font2 = new Font("宋体", 10, FontStyle.Underline);
             richTextBox1.SelectionFont = font2;
     定义字体,可以带2个参数,也可以带3个参数;.Font是控件的字体;.SelectionFont是选中部分的字体;

2 选中属性
         private void button2_Click(object sender, EventArgs e)
         {
             int startIndex = richTextBox1.SelectionStart;
             int length = richTextBox1.SelectionLength;
             textBox1.Text = startIndex.ToString() + "," + length.ToString();
         }
     选中的开始位置,SelectionStart;选中的字符长度,SelectionLength;

3 选中方法
         private void button3_Click(object sender, EventArgs e)
         {
             richTextBox1.Select(4, 4);
             textBox1.Text = richTextBox1.SelectedText;
         }
     Select(),从第n个位置开始,选中第二个参数的字符数;SelectedText,当前选中的文本;

4 取消选中
     两种方法,
             richTextBox1.DeselectAll(); 或者,
             richTextBox1.SelectionStart = 0;
             richTextBox1.SelectionLength = 0;
 5 选中字符的位置高度偏离基线的位移
richTextBox1.SelectionCharOffset = -6;
     选中字符向下偏离水平基线6个位置;如果为正,向上偏移;




















