我制作了一个大脑思维游戏,我坚持使用它的最后一部分。问题是..如何按下“第二行按钮”(btnRow2)后,右侧的4个小按钮自动显示答案?现在,我的代码工作得很完美,除了我必须按下答案按钮以检查我选择的颜色是否正确,我希望它们自动出现而不按下按钮。
我的第二行按钮代码
}
private void btnRow2_Click(object sender, EventArgs e)
{
btnChange1_1.Enabled = false;
btnChange1_2.Enabled = false;
btnChange1_3.Enabled = false;
btnChange1_4.Enabled = false;
btnChange2_1.Enabled = true;
btnChange2_2.Enabled = true;
btnChange2_3.Enabled = true;
btnChange2_4.Enabled = true;
btnRow2.Visible = false;
pictureBox2.Visible = true;
pictureBox1.Visible = false;
btnAnswer1_1.Visible = true;
btnAnswer1_2.Visible = true;
btnAnswer1_3.Visible = true;
btnAnswer1_4.Visible = true;
}
所有小答案框:
}
private void btnAnswer1_1_Click(object sender, EventArgs e)
{
if (btnChange1_1.BackColor == button1.BackColor)
{
btnAnswer1_1.BackColor = Color.Black;
}
if (btnChange1_1.BackColor == button2.BackColor)
{
btnAnswer1_1.BackColor = Color.Red;
}
if (btnChange1_1.BackColor == button3.BackColor)
{
btnAnswer1_1.BackColor = Color.Red;
}
if (btnChange1_1.BackColor == button4.BackColor)
{
}
{
btnChange1_4.Enabled = false;
btnChange1_3.Enabled = false;
btnChange1_2.Enabled = false;
btnChange1_1.Enabled = false;
}
}
private void btnAnswer1_2_Click(object sender, EventArgs e)
{
if (btnChange1_2.BackColor == button1.BackColor)
{
btnAnswer1_2.BackColor = Color.Red;
}
if (btnChange1_2.BackColor == button2.BackColor)
{
btnAnswer1_2.BackColor = Color.Black;
}
if (btnChange1_2.BackColor == button3.BackColor)
{
btnAnswer1_2.BackColor = Color.Red;
}
if (btnChange1_2.BackColor == button4.BackColor)
{
btnAnswer1_2.BackColor = Color.Red;
{
btnChange1_4.Enabled = false;
btnChange1_3.Enabled = false;
btnChange1_2.Enabled = false;
btnChange1_1.Enabled = false;
}
}
}
private void btnAnswer1_3_Click(object sender, EventArgs e)
{
if (btnChange1_3.BackColor == button1.BackColor)
{
btnAnswer1_3.BackColor = Color.Red;
}
if (btnChange1_3.BackColor == button2.BackColor)
{
btnAnswer1_3.BackColor = Color.Red;
}
if (btnChange1_3.BackColor == button3.BackColor)
{
btnAnswer1_3.BackColor = Color.Black;
}
if (btnChange1_3.BackColor == button4.BackColor)
{
btnAnswer1_3.BackColor = Color.Red;
}
{
btnChange1_4.Enabled = false;
btnChange1_3.Enabled = false;
btnChange1_2.Enabled = false;
btnChange1_1.Enabled = false;
}
}
private void btnAnswer1_4_Click(object sender, EventArgs e)
{
if (btnChange1_4.BackColor == button1.BackColor)
{
btnAnswer1_4.BackColor = Color.Red;
}
if (btnChange1_4.BackColor == button2.BackColor)
{
btnAnswer1_4.BackColor = Color.Red;
}
if (btnChange1_4.BackColor == button3.BackColor)
{
btnAnswer1_4.BackColor = Color.Red;
}
if (btnChange1_4.BackColor == button4.BackColor)
{
btnAnswer1_4.BackColor = Color.Black;
}
{
btnChange1_4.Enabled = false;
btnChange1_3.Enabled = false;
btnChange1_2.Enabled = false;
btnChange1_1.Enabled = false;
答案 0 :(得分:0)
创建一个执行答案按钮操作的方法,并在按下第2行时调用该方法。
无论如何,这是我的建议,但我对你真正想要的东西有点困惑:) GL