And why could not change the color of the form
Form1.BackColor = colorDialog1.Color;
with "ColorDialog"?
And why could not change the color of the form
Form1.BackColor = colorDialog1.Color;
with "ColorDialog"?
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; }
Source: https://ru.stackoverflow.com/questions/118447/
All Articles