namespace _17.字体和颜色对话框
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//新建字体对话框对象
FontDialog fd = new FontDialog();
//展示对话框
fd.ShowDialog();
//将选中的字体赋值给textBox的字体
textBox1.Font = fd.Font;
}
private void button2_Click(object sender, EventArgs e)
{
//新建颜色对话框对象
ColorDialog cd = new ColorDialog();
//展示对话框
cd.ShowDialog();
//将选中的颜色赋值给textBox的字体
textBox1.ForeColor = cd.Color;
}
}
}
东莞网站建设www.zg886.cn