RichTextBox控件允许用户输入和编辑文本的同时提供了比普通的TextBox控件更高级的格式特征
//color在c#中是个枚举enum
蓝色按钮:在蓝色按钮注册click事件后,richtextbox1.selectioncolor=color.blue;
红色按钮:在红色按钮注册click事件后,RichTextBox1.selectionColor=color.Red;
隶属18按钮;在注册click事件后,RichTextBox1.selectionFont=new font(“隶属”,18);
楷书18按钮;在注册事件后,RichTextBox1.selectionFont=new font(“楷书”,20);
项目符号;在注册事件后,RichTextBox1.selectionBullet=true;
底纹;在注册事件后,RichTextBox1.selectionBackColor=color.gray;//底纹就是背景颜色
复原://要看看richtextbox以前的字体是什么的,之后直接赋值就好了
RichTextBox1.selectionFont=new font(“宋体”,15);
RichTextBox1.selectionColor=color.white;//上面所有的都要写回来
private void blue_Click(object sender, EventArgs e)
{
//richb.选择颜色=颜色中的蓝色
Richb.SelectionColor = Color.Blue;
}
private void red_Click(object sender, EventArgs e)
{
Richb.SelectionColor = Color.Red;
}
private void fontKt18_Click(object sender, EventArgs e)
{
Richb.SelectionFont = new Font("楷书",18);
}
private void micr20_Click(object sender, EventArgs e)
{
Richb.SelectionFont = new Font("微软雅黑", 18);
}
private void DWbut_Click(object sender, EventArgs e)
{
Richb.SelectionBackColor = Color.Yellow;
}
private void resat_Click(object sender, EventArgs e)
{
Richb.SelectionBackColor = Color.White;
Richb.SelectionColor = Color.Black;
Richb.SelectionFont = new Font("宋体",9);
}
private void blue_Click(object sender, EventArgs e) { //richb.选择颜色=颜色中的蓝色 Richb.SelectionColor = Color.Blue; } private void red_Click(object sender, EventArgs e) { Richb.SelectionColor = Color.Red; } private void fontKt18_Click(object sender, EventArgs e) { Richb.SelectionFont = new Font("楷书",18); } private void micr20_Click(object sender, EventArgs e) { Richb.SelectionFont = new Font("微软雅黑", 18); } private void DWbut_Click(object sender, EventArgs e) { Richb.SelectionBackColor = Color.Yellow; } private void resat_Click(object sender, EventArgs e) { Richb.SelectionBackColor = Color.White; Richb.SelectionColor = Color.Black; Richb.SelectionFont = new Font("宋体",9); }