using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace ColourPaletteDemo { public partial class ColourPaletteDemoForm : Form { private static ColorDialog colorChooser = new ColorDialog(); public ColourPaletteDemoForm() { InitializeComponent(); } private void textColourButton_Click(object sender, EventArgs e) { DialogResult result = colorChooser.ShowDialog(); if (result==DialogResult.Cancel) return; messageLabel.ForeColor = colorChooser.Color; } private void BackgroundColourButton_Click(object sender, EventArgs e) { colorChooser.FullOpen = true; DialogResult result = colorChooser.ShowDialog(); if (result == DialogResult.Cancel) return; this.BackColor = colorChooser.Color; } } }