using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsRadioButton { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void radioButton2_Click(object sender, EventArgs e) { if(radioButton2.Checked == true) { MessageBox.Show("RadioButton2控件被选中"); } } private void radioButton1_Click(object sender, EventArgs e) { if (radioButton1.Checked == true) { MessageBox.Show("RadioButton1控件被选中"); } } private void Form1_Load(object sender, EventArgs e) { radioButton1.Checked = false; radioButton2.Checked = false; } } }