1、创建多个CheckButton
2、在设计器中选中这些CheckButton控件,在属性中设置 GroupIndex 值(默认为-1),可以转换为单选按钮组。
3、设置这些 CheckButton 组的Click 关联函数为同一个,如
private void but_Click(object sender, System.EventArgs e)
{
//用sender 判定是那个控件
string strTitle = ((CheckButton)sender).Text;
if(strTitle=="选择")
{
绘制方式 = 0;
}
}
本文介绍了如何在WindowsForms中创建多个CheckButton,并通过设置GroupIndex将它们转换为单选按钮组,同时共享一个Click事件处理函数以识别用户的选择。
1009

被折叠的 条评论
为什么被折叠?



