自定义控件添加事件

来源:互联网 发布:数据的保密性 编辑:程序博客网 时间:2024/03/28 17:03

自定义控件添加事件

using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using System.Linq;using System.Text;using System.Windows.Forms;namespace Test{    public partial class EventTest : UserControl    {        //事件.        public event EventHandler instanceEventTest;        private void RaiseinstanceEventTest()        {            if (instanceEventTest != null)            {                instanceEventTest(this,EventArgs.Empty);            }        }        public EventTest()        {            InitializeComponent();        }        private void button1_Click(object sender, EventArgs e)        {            RaiseinstanceEventTest();        }    }}


0 0