更新时间:2023-12-01 11:01:34
没有因为GroupBoxes并不意味着只是单选按钮。它是一种通用集装箱的控制。要检查什么被选中,你可以做一个符合的LINQ
。
No since GroupBoxes are not meant for just RadioButtons. Its a general container control. To check if anything is checked, you could do in one line with Linq
.
bool anyChecked = gb.Controls.OfType<RadioButton>().Any(rb => rb.Checked);
或者你可以用它创建自己的扩展方法,方便地调用它如果经常重复使用。
Or you could create your own extension method with it and call it easily if its often re-used.