using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace ColorFontDialogTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnBackColor_Click(object sender, EventArgs e) { if (colorDialog1.ShowDialog() == DialogResult.OK) { this.BackColor = colorDialog1.Color; } } private void btnFont_Click(object sender, EventArgs e) { if (fontDialog1.ShowDialog() == DialogResult.OK) { textBox1.Font = fontDialog1.Font; } } private void Form1_Load(object sender, EventArgs e) { textBox1.Text = "测试字体属性的文字,试试这段话的字体属性会不会被修改"; } } }