It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




9年前关闭。




我想知道我们如何取消选中单选按钮。它应该像复选框一样工作。

最佳答案

使用以下代码来使用复选框之类的单选按钮。

    bool isChecked =false;
    private void radioButton1_CheckedChanged(object sender, EventArgs e)
    {
        isChecked = radioButton1.Checked;
    }

    private void radioButton1_Click(object sender, EventArgs e)
    {
        if (radioButton1.Checked && !isChecked)
            radioButton1.Checked = false;
        else
        {
            radioButton1.Checked = true;
            isChecked = false;
        }
    }

关于c# - 我们如何取消选中单选按钮,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10698239/

10-10 23:26