/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public virtual void buttonCheckControl_Click(object sender, EventArgs e) { ButtonCheckControl bcc = (ButtonCheckControl)sender; switch (bcc.Name) { case "buttonCheckControl_led": if (this.buttonCheckControl_led.Checked) { this.ledButtonControl_led.LedColor = Color.Red; } else { this.ledButtonControl_led.LedColor = Color.Black; } //---用户事件 if (this.UserClick != null) { this.UserClick(sender, e); } break; default: break; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public virtual void buttonCheckControl_Click(object sender, EventArgs e) { ButtonCheckControl bcc = (ButtonCheckControl)sender; int index = 0; switch (bcc.Name) { case "buttonCheckControl_Channel1": index = 1; break; case "buttonCheckControl_Channel2": index = 2; break; case "buttonCheckControl_Channel3": index = 3; break; case "buttonCheckControl_Channel4": index = 4; break; default: break; } //---执行委托函数 if ((this.UserButtonCheckControlClick != null) && (index != 0)) { this.UserButtonCheckControlClick(sender, e, index, bcc.Checked); } }