110,502
社区成员
发帖
与我相关
我的任务
分享
foreach (Control contr in this.Controls)
{
if (contr is Panel)
contr.Visible = false;
}
panal.Visible=false;//隐藏
private void clearInput(Control control)
{
string controlTypeString="";
foreach (Control c in control.Controls)
{
controlTypeString=c.GetType().ToString();
switch (controlTypeString)
{
case "System.Windows.Forms.TextBox":
((TextBox)c).Text = string.Empty;
break;
case "System.Windows.Forms.CheckBox":
((CheckBox)c).Checked = false;
break;
case "System.Windows.Forms.NumericUpDown":
((NumericUpDown)c).Value = decimal.Parse("0");
break;
case "System.Windows.Forms.GroupBox":
clearInput(c);
break;
}
}
}
foreach (Control c in Controls)
{
if (c is Panel)
{
((Panel)c).Visible = false;
}
}
panel1.Visible = true;