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());//把按钮自身作为参数传递
        }

       
    }

 

posted @ 2018-04-19 20:54  小小高  阅读(383)  评论(0)    收藏  举报