CJH的儲思盆 – 技術.管理.思考 小 工 程 師 職 場 打 滾 記 事

12六月/070

Radio Button研究

當兩個以上的Radio Button,裝在同一個容器(container)中,只有一個Radio Button會在Checked狀態

測試案例:

  1. 一個FlowLayoutPanel裡面裝著兩個RadioButton
  2. button1的index較前面,所以一開始預設就會引發CheckedChanged事件,並且為Checked=true
  3. 利用程式碼先後設定RadioButton為Checked = true
  4. 設定button1時,因為已經是True所以不變,也沒有引發事件
  5. 設定button2時
    • 先引發button1的CheckedChanged事件,Checked設為False
    • 在引發button2的CheckedChanged事件,Checked設為True
分類於: 程設 沒有回覆