我加载了 4 个单选按钮,当我运行程序并单击它们时,如果我单击一个,然后单击另一个,其他按钮就会消失。如果我想有两个单选按钮但它们做不同的事情怎么办?
最佳答案
将不同的选择集分组到单独的组框(或面板,或其他容器控件,但组框可能是您想要的)。
MSDN :
Windows Forms RadioButton controls are designed to give users a choice among two or more settings, of which only one can be assigned to a procedure or object. For example, a group of RadioButton controls may display a choice of package carriers for an order, but only one of the carriers will be used. Therefore only one RadioButton at a time can be selected, even if it is a part of a functional group.
You group radio buttons by drawing them inside a container such as a Panel control, a GroupBox control, or a form.
假设您的表单上有四个或更多单选按钮。例如,如果您只有两个,并且您希望允许用户同时选择两个,请使用一组复选框。
关于C# WinForms 单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3851765/