C#事件_Sample_3
事件的拥有者同时是事件的响应者
using System; using System.Windows.Forms; /// <summary> /// 事件的拥有者同时是事件的响应者 /// </summary> namespace _20200328_事件_Sample_3 { class Program { static void Main(string[] args) { MyForm form = new MyForm(); //事件的拥有者 form.Click += form.FormClick; form.ShowDialog(); } } class MyForm : Form //继承Form类 { internal void FormClick(object sender, EventArgs e) { this.Text = DateTime.Now.ToString(); } } }