0
点赞
收藏
分享

微信扫一扫

C#编程:查找窗体内某种控件,并进行属性设置

伢赞 2022-05-09 阅读 30


C#编程:查找窗体内某种控件,并进行属性设置_编程开发

private void button3_Enter(object sender, EventArgs e)
{
foreach (Control tempcon in this.Controls)
{
switch (tempcon.GetType().ToString())
{
case "System.Windows.Forms.Label":

break;
case "System.Windows.Forms.Panel":

break;
case "System.Windows.Forms.GroupBox":

break;
case "System.Windows.Forms.Button":
tempcon.Enabled = false;
break;
}
}

Thread.Sleep(3000);

foreach (Control tempcon in this.Controls)
{
switch (tempcon.GetType().ToString())
{
case "System.Windows.Forms.Label":

break;
case "System.Windows.Forms.Panel":

break;
case "System.Windows.Forms.GroupBox":

break;
case "System.Windows.Forms.Button":
tempcon.Enabled = true;
break;
}
}
}



举报

相关推荐

0 条评论