Display Color Dialog and get the selection : ColorDialog « GUI Windows Forms « C# / CSharp Tutorial






using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class MainClass{

    public static void Main() {
        System.Windows.Forms.ColorDialog colorDlg = new System.Windows.Forms.ColorDialog();
        Color currColor;
                
        colorDlg.AnyColor = true;
        colorDlg.ShowHelp = true;

        currColor = Color.BlueViolet;
 
        if (colorDlg.ShowDialog() != DialogResult.Cancel)  {
             currColor = colorDlg.Color;

            // Show current color.
             string strARGB = colorDlg.Color.ToString();
             MessageBox.Show(strARGB, "Color is:");
        }
    }
}








23.47.ColorDialog
23.47.1.ColorDialog.FullOpen = trueColorDialog.FullOpen = true
23.47.2.ColorDialog.AllFullOpen = falseColorDialog.AllFullOpen = false
23.47.3.Set default colorSet default color
23.47.4.ColorDialog With Custom ColorColorDialog With Custom Color
23.47.5.Display Color Dialog and get the selection