日期:2014-05-18  浏览次数:20746 次

关于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":

}
}