我们在做应用程序的时候有时候想知道页面上的按钮对于某一事件委托链上有多少方法,下面是一个例子。
1、先添加3个按钮,分别添加0个,1个,2个click事件的方法,按钮名字分别为button1,button2,button3。
this
.button2.Click
+=
new
System.EventHandler(
this
.button2_Click);
this .button3.Click += new System.EventHandler( this .button3_Click1);
this .button3.Click += new System.EventHandler( this .button3_Click2);
this .button3.Click += new System.EventHandler( this .button3_Click1);
this .button3.Click += new System.EventHandler( this .button3_Click2);
2、方法里面可以随便写点代码: