C#更改颜色和字体

实现效果

C#更改颜色和字体

 

1,窗口中添加colorDialog与fontDialog工具

C#更改颜色和字体
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;
using System.IO;
using System.Drawing.Drawing2D;

namespace App1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog()==DialogResult.OK)
            {
                label1.ForeColor = colorDialog1.Color;
            }
        }

        private void Button2_Click(object sender, EventArgs e)
        {
            if (fontDialog1.ShowDialog()==DialogResult.OK)
            {
                label1.Font = fontDialog1.Font;
            }
        }
    }
}
App1

 

C#更改颜色和字体

上一篇:windows2008 R2 虚拟机 hyper-v


下一篇:C#实现地图坐标系的转换(WGS-84、GCJ-02、BD-09)