List of Exercises

How to Show Color Dialog Box in | C#

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

    private void color_Click(object sender, EventArgs e)
    {
      var res = colorDialog1.ShowDialog();
      if (res == DialogResult.OK)
      { pictureBox1.BackColor = colorDialog1.Color; }
    }

    private void color1_Click(object sender, EventArgs e)
    {
      ColorDialog colorDialog = new ColorDialog();
      // Keeps the user from selecting a custom color.
      colorDialog.AllowFullOpen = false;
      // Sets the initial color select to the current pictureBox1 color.
      if (colorDialog.ShowDialog() == DialogResult.OK)
        pictureBox1.BackColor = colorDialog.Color;
    }
  }
}
	


Download the project of Visual Studio 2013 in DropBox Download


How to use ColorDialog Control in C# WinForms Visual Studio


Video Thumbnail