功能
C#实现利用单选框实现更改文本的richTextBox字体、大小、加粗
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace 单选界面 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void richTextBox1_TextChanged(object sender, EventArgs e) { } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (jiazu.Checked) richTextBox1.Font = new Font(richTextBox1.Font, richTextBox1.Font.Style | FontStyle.Bold); else richTextBox1.Font = new Font(richTextBox1.Font, richTextBox1.Font.Style ^ FontStyle.Bold); } private void radioButton1_CheckedChanged(object sender, EventArgs e) { richTextBox1.Font = new Font("宋体", richTextBox1.Font.Size, richTextBox1.Font.Style); } private void radioButton4_CheckedChanged(object sender, EventArgs e) { richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, 10, richTextBox1.Font.Style); } private void radioButton3_CheckedChanged(object sender, EventArgs e) { richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, 16, richTextBox1.Font.Style); } private void radioButton2_CheckedChanged(object sender, EventArgs e) { richTextBox1.Font = new Font("楷体", richTextBox1.Font.Size, richTextBox1.Font.Style); } } }后续
如果想了解更多物联网、智能家居项目知识,可以关注我的程序设计专栏。
或者关注公众号。
编写不易,感谢支持。