为什么CheckBox只能控制Panel控件的显示,不能控制它的隐藏呢?
原因:
private void CheckBox1_CheckedChanged(object sender, System.EventArgs e)
{
if( this.CheckBox1.Checked == (这里少了一个等于号)true)
{
this.Panel1.Visible=true;
}
else
{
this.Panel1.Visible=false;
}
}
本文解答了一个关于CheckBox控件的问题,即为何CheckBox只能控制Panel控件的显示而不能控制其隐藏。通过修正代码中的一处错误——添加缺少的等号,使得CheckBox能够正确地控制Panel的显示与隐藏。
5万+

被折叠的 条评论
为什么被折叠?



