List<Control> m_FormControls = new List<Control>(); //添加了3个控件进去
private void Btn_Back_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.m_FormCount; i++)
{
//this.m_FormControls[2].Visible = (i == (this.m_CurrentFormIndex + 1)); //先是这么写的,以为这么写有什么Bug //后来改成这个样子 还是不行
if (i == this.m_CurrentFormIndex + 1)
{
this.m_FormControls[i].Visible = true; //执行了这步 ,但是this.m_FormControls[i].Visible仍然是false
}
else
{
this.m_FormControls[i].Visible = false;
}
}
}
this.m_CurrentFormIndex++;
this.Lbl_PageNow.Text = (this.m_CurrentFormIndex + 1).ToString();
OnPageChanged(this, new EventArgs());
this.Btn_Back.Enabled = !(this.m_CurrentFormIndex == 0);
this.Btn_Next.Enabled = !(this.m_CurrentFormIndex == this.m_FormCount - 1);
给大家看了这么多,大家应该还没明白是什么意思...............我的问题: 我单步调试,明明后面是个true,赋值完后this.m_FormControls[i].Visible仍然是个false,气死我了,要吐血了,给老大看 ,他也不知道咋回事.......单击button第一次时没问题(就是显示第二个控件正常,显示第3个时显示不出来,默认是显示第一个控件),单击第二次是就出现上面那个问题我把它改成 this.m_FormControls[2].Visible = true; 又没问题.....不知道有人遇到过没.........
private void Btn_Back_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.m_FormCount; i++)
{
//this.m_FormControls[2].Visible = (i == (this.m_CurrentFormIndex + 1)); //先是这么写的,以为这么写有什么Bug //后来改成这个样子 还是不行
if (i == this.m_CurrentFormIndex + 1)
{
this.m_FormControls[i].Visible = true; //执行了这步 ,但是this.m_FormControls[i].Visible仍然是false
}
else
{
this.m_FormControls[i].Visible = false;
}
}
}
this.m_CurrentFormIndex++;
this.Lbl_PageNow.Text = (this.m_CurrentFormIndex + 1).ToString();
OnPageChanged(this, new EventArgs());
this.Btn_Back.Enabled = !(this.m_CurrentFormIndex == 0);
this.Btn_Next.Enabled = !(this.m_CurrentFormIndex == this.m_FormCount - 1);
给大家看了这么多,大家应该还没明白是什么意思...............我的问题: 我单步调试,明明后面是个true,赋值完后this.m_FormControls[i].Visible仍然是个false,气死我了,要吐血了,给老大看 ,他也不知道咋回事.......单击button第一次时没问题(就是显示第二个控件正常,显示第3个时显示不出来,默认是显示第一个控件),单击第二次是就出现上面那个问题我把它改成 this.m_FormControls[2].Visible = true; 又没问题.....不知道有人遇到过没.........
groupbox3 成了groupbox2的子控件了 ,肉眼没看出来,后来七一拉八一拉 看出来哒.......父容器的Visibile 是false 那么 子的 也是false了..哎 害死我了........... 让大家见笑啦..... , , ,