Form.cs代码文件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { private Event myEvent = null; public Form1() { InitializeComponent(); myEvent = new Event(); myEvent.stringEvent+=new outputEventHandler(myEvent_stringEvent); } private void button1_Click(object sender, EventArgs e) { myEvent.excuit(textBox1.Text.ToString()); myEvent.stringEvent += new outputEventHandler(myEvent_stringEvent); } void myEvent_stringEvent(object sender, MyStringEventArgs str) { label1.Text += str.outString; } } } Event.cs代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace WindowsFormsApplication1 { public delegate void outputEventHandler(object sender, MyStringEventArgs str); class Event { public event outputEventHandler stringEvent; protected virtual void onOUT(MyStringEventArgs s) { if(s!=null) stringEvent(this,s); } internal void excuit(string s) { MyStringEventArgs my = new MyStringEventArgs(s); onOUT(my); } } public class MyStringEventArgs : EventArgs { private string _str; public MyStringEventArgs(string myStr) { this._str=myStr; } public string outString { get{return this._str;} } } }