Warning: file_put_contents(/datas/wwwroot/jiajiahui/core/caches/caches_template/2/default/show.php): failed to open stream: Permission denied in /datas/wwwroot/jiajiahui/core/libraries/classes/template_cache.class.php on line 55

Warning: chmod(): Operation not permitted in /datas/wwwroot/jiajiahui/core/libraries/classes/template_cache.class.php on line 56
17.WinForm练习--字体,颜色对话框 - 源码之家

17.WinForm练习--字体,颜色对话框

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;
    }
}

}