Event委托
2011-08-09 11:56 Carl Xing 阅读(293) 评论(0) 编辑 收藏 举报public class ArgButton:Button { public delegate void OnArgClick(btnEventArgs e); public event OnArgClick ArgClick; private string Args { get; set; } public ArgButton() { } public ArgButton(string args) { this.Args = args; this.Click += new EventHandler(ArgButton_Click); } void ArgButton_Click(object sender, EventArgs e) { if (ArgClick != null) { ArgClick(new btnEventArgs(Args)); } } } public class btnEventArgs:EventArgs { private string args; public btnEventArgs(string args) { this.args = args; } public string Args { get { return this.args; } } }