public form1() { InitializeComponent(); this.radioButton1.CheckedChanged += new EventHandler(this.radioBtn_CheckedChange);//初始化事件 this.radioButton2.CheckedChanged += new EventHandler(this.radioBtn_CheckedChange); } private void form1_Load(object sender, EventArgs e) { } private void radioBtn_CheckedChange(object sender, EventArgs e) //根据button的text进行选择 { if (!((RadioButton)sender).Checked) { return; } switch (((RadioButton)sender).Text.ToString()) { case "开始扫描工位":break; case "结束扫描工位":break; } }
时间: 2024-10-31 15:54:48