实现效果
1,窗口中添加colorDialog与fontDialog工具
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; } } } }