And why could not change the color of the form

Form1.BackColor = colorDialog1.Color; 

with "ColorDialog"?

  • ForeColor is the color of the font. You Need BackColor - Cheburashka
  • sorry typo - lalal am

1 answer 1

Hello!

The first mistake, you refer to the Form1 class, in C # this is a blunder, in Visual Basic'e 6.0 this could be done, but in .NET it is already impossible ... You should write this:

 if (colorDialog1.ShowDialog() == DialogResult.OK) { this.ForeColor = colorDialog.Color; } 

Then another mistake, if you want to change the color of the form , and not the font color, then you should not use ForeColor, but BackColor.

Code for BackColor:

 if (colorDialog1.ShowDialog() == DialogResult.OK) { this.BackColor = colorDialog.Color; }