标签:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace checkboxTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked) { checkBox2.Checked = false; checkBox3.Checked = false; MessageBox.Show("1OK"); } } private void checkBox2_CheckedChanged(object sender, EventArgs e) { if (checkBox2.Checked) { checkBox1.Checked = false; checkBox3.Checked = false; MessageBox.Show("2OK"); } } private void checkBox3_CheckedChanged(object sender, EventArgs e) { if (checkBox3.Checked) { checkBox1.Checked = false; checkBox2.Checked = false; MessageBox.Show("3OK"); } } } }
在多个checkBox中进行切换代码。
标签:
原文地址:http://www.cnblogs.com/chinatrust/p/4342825.html