首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

关于switch的有关问题

2012-01-05 
关于switch的问题C# code if (this.radioButton2.Checked){this.skinEngine1.SkinFile EmeraldColor2.s

关于switch的问题

C# code
 if (this.radioButton2.Checked)            {                this.skinEngine1.SkinFile = "EmeraldColor2.ssk";                return;            }            else if (this.radioButton3.Checked)            {                this.skinEngine1.SkinFile = "MidsummerColor2.ssk";                return;            }            

请问下 如果要转成 switch的话怎么写。 radiobutton 没有 selectvalue属性啊。。

[解决办法]
你是判断它是不是被选中...
用switch的话不如直接用if else呢

foreach (RadioButton rad in this.Controls)
{
switch (rad.Name)
{
case "radioButton2":
if (radioButton2.Checked)
{ this.skinEngine1.SkinFile = "EmeraldColor2.ssk";
}
break;
case "radioButton3":

}
}

热点排行