我定义了一个页面上有很多Button aa, bb, cc, dd
然后有一个 string strbt 类型的变量要求当string strbt 的值为 aa 时 button aa 的 BackColor为Red
值为 bb 时 button bb 的 BackColor为Red 请问如何实现 ? 在线等
然后有一个 string strbt 类型的变量要求当string strbt 的值为 aa 时 button aa 的 BackColor为Red
值为 bb 时 button bb 的 BackColor为Red 请问如何实现 ? 在线等
foreach(control c in dad)
{
if(c is Button)
if ((Button)c.ID == strbt){
(Button)c.Backcolor = color.red
}
else{
(Button)c.Backcolor = defaultcolor;}
}
but.BackColor=Color.Red;
switch(strbt)
{
case "aa":
aa.BackColor=Color.Red;
break;
case "bb":
bb.BackColor = Color.Red;
break;}