本文介绍了单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在第二次单击时取消选中(单选按钮). (例如,我单击一次,它会打一个勾号-我再次单击它会删除它).

I want to uncheck a (radio button) on the 2nd click. (e.g. I click once, it puts a check mark - I click a second time, it removes it).

推荐答案



bool blnState;

public Form1()
{
    InitializeComponent();
}

private void radioButton1_MouseDown(object sender, MouseEventArgs e)
{
    blnState = radioButton1.Checked;
}

private void radioButton1_MouseUp(object sender, MouseEventArgs e)
{
    radioButton1.Checked = !blnState;
}



其中radioButton1是您正在使用的单选按钮的名称.
我已经使用了此控件的mousedown和mouseup事件.



where radioButton1 is the name of the radio button that you are using.
I have used the mousedown and mouseup events of this control.


这篇关于单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-22 14:58