Мне нужно создать программу на C # в visual studio 2015, которая начинается с показа трех текстовых полей, доступных только для чтения, нижнее - зеленое, а среднее и верхнее - серое.Когда клавиша табуляции нажата, средний блок должен стать желтым, а два других - серым.Затем при повторном нажатии клавиши табуляции верхний блок становится красным, а два нижних - серым и повторяются с клавишей табуляции.Я не могу заставить ящики менять цвет, если я не снимаю их с чтения и продолжаю печатать в ящиках.Как я могу исправить свой код, чтобы изменить цвета с помощью клавиши табуляции?
//when the txtRed box is active, it turns red and the others go gray
private void txtRed_TextChanged(object sender, EventArgs e)
{
txtRed.BackColor = System.Drawing.Color.Red;
txtYellow.BackColor = System.Drawing.Color.DarkGray;
txtGreen.BackColor = System.Drawing.Color.DarkGray;
}
//when the txtYellow box is active, it turns yellow and the others go gray
private void txtYellow_TextChanged(object sender, EventArgs e)
{
txtRed.BackColor = System.Drawing.Color.DarkGray;
txtYellow.BackColor = System.Drawing.Color.Yellow;
txtGreen.BackColor = System.Drawing.Color.DarkGray;
}
//when the txtGreen box is active, it turns green and the others go gray
private void txtGreen_TextChanged(object sender, EventArgs e)
{
txtRed.BackColor = System.Drawing.Color.DarkGray;
txtYellow.BackColor = System.Drawing.Color.DarkGray;
txtGreen.BackColor = System.Drawing.Color.Green;
}
//allows btnExit to terminate the program
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}