winform 用户控件事件的写法
public partial class UcTest : UserControl { public UcTest() { InitializeComponent(); } //定义事件 public event EventHandler UserControlBtnClicked; private void btn_Click(object sender, EventArgs e) { UserControlBtnClicked?.Invoke(sender, new EventArgs());//把按钮自身作为参数传递 } }

浙公网安备 33010602011771号