日期:2014-05-17 浏览次数:20797 次
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
new ControlHelper(button1);
new ControlHelper(button2);
}
}
public class ControlHelper
{
readonly Control _control;
public ControlHelper(Control control)
{
_control = control;
_control.Click += a;
_control.Paint += b;
}
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ClickClass c = new ClickClass();
ExtButton<ClickClass> clickButton = new ExtButton<ClickClass>(c);
clickButton.Location = new System.Drawing.Point(64, 66);
clickButton.Name = "button2";
clickButton.Size = new System.Drawing.Size(75, 23);
clickButton.TabIndex = 1;
clickButton.Text = "button2";
clickButton.UseVisualStyleBackColor = true;
this.Controls.Add(clickButton);
}
}
public abstract class ExtClass
{
public virtual void