Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

19. Windows Forms Common Dialogs

19.1 How do I use the ColorDialog to pick a color?


It is straight-forward. Create an instance of the class and call its ShowDialog method.

     ColorDialog colorDialog1 = new ColorDialog();
     //fontDialog1.ShowColor = true;
     if(colorDialog1.ShowDialog() != DialogResult.Cancel )
     {
          textBox1.ForeColor = colorDialog1.Color;
     }
     textBox1.Text = "this is a test";