C# Color Dialog Box
There are several classes that implement common dialog boxes, such as color selection , print setup etc.
A ColorDialog object is a dialog box with a list of colors that are defined for the display system. The user can select or create a particular color from the list, which is then reported back to the application when the dialog box exits. You can invite a color dialog box by calling ShowDialog() method.
 
ColorDialog dlg = new ColorDialog();
dlg.ShowDialog();
 
The following C# program invites a color dialog box and retrieve the selected color to a string.
Full Source C# 
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
  public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
      private void button1_Click(object sender, EventArgs e)
      {
          ColorDialog dlg = new ColorDialog();
          dlg.ShowDialog();
          if (dlg.ShowDialog() == DialogResult.OK)
          {
              string str = null;
              str = dlg.Color.Name;
              MessageBox.Show (str);
          }
      }
  }
}
 
 
				Related Topics
				
			
- C# Visual Studio IDE
 - How to Create a C# Windows Forms Application
 - C# Label Control
 - C# Button Control
 
- C# TextBox Control
 - C# ComboBox
 - C# ListBox Control
 - C# Checked ListBox Control
 - C# RadioButton Control
 - C# CheckBox Control
 - C# PictureBox Control
 - C# ProgressBar Control
 - C# ScrollBars Control
 - C# DateTimePicker Control
 - C# Treeview Control
 - C# ListView Control
 - C# Menu Control
 - C# MDI Form
 - C# Font Dialog Box
 - C# OpenFile Dialog Box
 - C# Print Dialog Box
 - keyPress event in C# , KeyDown event in C# , KeyUp event in C#
 - How to create Dynamic Controls in C# ?
 - Keep Form on Top of All Other Windows
 - C# Timer Control