Home   Cover Cover Cover Cover
 

Color dialogs

Chap4_Ex23.cs
using System;
using System.Windows.Forms;
using System.Drawing;


public class Chap4_Ex23_Test {
  public static void Main(string[] args) {
    ColorDialog cdia = new ColorDialog();
    // Keeps the user from selecting a custom color.
    cdia.AllowFullOpen = false ;
    // Allows the user to get help. (The default is false.)
    cdia.ShowHelp = true ;
    // Sets the initial color select to the current text color.
    // Update the text box color if the user clicks OK 
    if (cdia.ShowDialog() == DialogResult.OK)
      Console.WriteLine(cdia.Color);
  }
}