当前位置: 代码迷 >> ASP.NET >> 颜色有关问题。
  详细解决方案

颜色有关问题。

热度:1061   发布时间:2013-02-25 00:00:00.0
颜色问题。。。
switch   (Label1.Text)
                {  
                        case   "1 ":
                                Label1.Text   =   "一般 ";   break;
                        case   "2 ":
                                Label1.Text   =   "紧急 ";   break;
                                Label1.BackColor= "#cccccc "
                               
                        case   "3 ":
                                Label1.Text   =   "特急 ";   break;
                                Label1.BackColor= "red "
                    }
这种写法错了,,报错无法string转换为color
那位给出真确写法

------解决方案--------------------------------------------------------

switch (Label1.Text)
{
case "1 ":
Label1.Text = "一般 ";
break;
case "2 ":
Label1.Text = "紧急 ";
Label1.BackColor = Color.Red;
break;

case "3 ":
Label1.Text = "特急 ";
Label1.BackColor = Color.Red;
break;
}
  相关解决方案