Setting
groupBox1.ForeColor
changes the forecolor of other controls like button, label etc residing inside the groupbox which has to be unwelcome in most cases if you only need to change the text colour of groupbox. A simple workaround will be
private void button1_Click(object sender, EventArgs e)
{
List<Color> lstColour = new List<Color>();
foreach (Control c in groupBox1.Controls)
lstColour.Add(c.ForeColor);
groupBox1.ForeColor = Color.Red; //the colour you prefer for the text
int index = 0;
foreach (Control c in groupBox1.Controls)
{
c.ForeColor = lstColour[index];
index++;
}
}
Of course the above code can be meaningless if you are adding controls programmatically later to the groupbox, but the good thing is you can handle all that situations by adding extra conditions in code. To be doubly sure, a list of keyvaluepair of control and forecolor can be employed.