foreach (Control c in this.Panel1.Controls) 【控件名字 + 随便起的名字 in  页面控件】  (Control 什么意思)
        {
            if (c is RadioButton)
            {
                if (((RadioButton)c).Checked == true) 【判断】?()
                {
                    Label2.Text ;(用label 显示 没写完..)
                }
            }
        }高手能帮我讲讲 每行吗?

解决方案 »

  1.   

    this.Panel1.Controls是一组控件,control是其中的一个;foreach (Control c in this.Panel1.Controls) //遍历这个控件组;
      {
      if (c is RadioButton) //如果是单选按钮
      {
      if (((RadioButton)c).Checked == true) //如果此单选按钮已被选中
      {
      Label2.Text ;//更新label2
      }
      }
      }
      

  2.   


    foreach (Control c in this.Panel1.Controls) 【控件名字 + 随便起的名字 in 页面控件】 (Control 什么意思) //Control 是类型,比如这里指的是Control类
      {
      if (c is RadioButton)
      {
      if (((RadioButton)c).Checked == true) 【判断】?()//先把c转换成RadioButton类型,然后判断是否选中
      {
      Label2.Text ;(用label 显示 没写完..)
      }
      }
      }
      

  3.   


    foreach (Control c in this.Panel1.Controls) 【控件名字 + 随便起的名字 in 页面控件】 (Control 什么意思) //Control是类型名(控件类),c嘛任意的一个别名,this.Panel1.Controls控件集合。表示遍历在控件Panel1中的每一个控件~
      {
      if (c is RadioButton)//如果遍历到得其中一个控件类型是单选框(RadioButton类型)
      {
      if (((RadioButton)c).Checked == true) 【判断】?()//将c的类型强制转换为单选框类型,并判断它的属性Checked是不是true(即是否选中)
      {
      Label2.Text ;(用label 显示 没写完..)//坑爹的没写完……
      }
      }
      }