单选按钮为一组在不同的面板单选、按钮、面板、不同

2023-09-04 00:41:24 作者:原谅我不擅表达却那么喜欢

我用 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.

 
精彩推荐
图片推荐