单选按钮为一组在不同的面板 [英] Radiobuttons as a group in different panels
问题描述
我用 C#
来制定 WindowsForms
应用程序。我已经创建了一些面板的一种形式。每个小组有一个单选
。当我点击一个单选
,然后另外一个,两个都选中。
I'm using C#
to develop WindowsForms
application. I have created a form with some panels. Each panel has a RadioButton
. When I click a RadioButton
, and then other one, both are checked.
我怎么能模拟所有的单选按钮
在同一个组,所以只有一个可以进行检查,和其他人都没有选中?
How could I simulate that all the RadioButtons
are in the same group, so only one can be checked, and the others are unchecked?
当然,我可以控制的CheckedChanged事件,每个单选
...但有没有更好的解决办法?
Of course, I can control the checkedChanged event for each RadioButton
... but is there any better solution?
在此先感谢。
推荐答案
单选按钮会自动,如果他们是相同的父的内部链接。既然你想让他们住在不同的容器中,你将不得不手动将它们链接。
RadioButtons are automatically linked if they are inside the same parent. Since you want them to live in different containers you will have to link them manually.
这篇关于单选按钮为一组在不同的面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!