110,538
社区成员
发帖
与我相关
我的任务
分享
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
// 假设radioButton1对应textBox1、radioButton2对应textBox2、radioButtonN对应textBoxN
// 恢复原始状态
for (int i = 1; i <= 3; i++)
{
Control[] controls = Controls.Find(string.Format("textBox{0}", i), true);
if (controls.Length > 0) controls[0].Enabled = true;
}
Control[] textBoxs = Controls.Find(string.Format("textBox{0}",
((Control)sender).Name.Remove(0, "radioButton".Length)), true);
if (textBoxs.Length > 0) textBoxs[0].Enabled = false;
}