111,128
社区成员
发帖
与我相关
我的任务
分享namespace UcDll
{
public partial class UcTest: UserControl
{
public UcTest()
{
InitializeComponent();
}
//定义委托
public delegate void BtnClickHandle(object sender, EventArgs e);
//定义事件
public event BtnClickHandle UserControlBtnClicked;
private void btn_Click(object sender, EventArgs e)
{
if (UserControlBtnClicked != null)
{
UserControlBtnClicked(sender, new EventArgs());//把按钮自身作为参数传递
label1.Text = "wawawa";
}
}
}
}
[/quote]
左下角很明显了,UserControlBtnClicked 是null啊