前面介绍了添加自定义控件属性,这里是事件,当自定义控件的属性UserOK为true时,触发Userloginsuccess事件,代码如下:
//定义委托 public delegate void BtnClickHandle(object sender, EventArgs e); //定义事件 public event BtnClickHandle UserLoginsuccessful;
调用事件:
private void userControl11_UserLoginsuccessful(object sender, EventArgs e) { MessageBox.Show("ewewewewew"); } }