换种思路 public class AButton : Button
{
public int tem = 0;
}private void MdiForm_Load(object sender, EventArgs e)
{
AButton b= new AButton ();
b.item=10;
this.Controls.Add(b);
}
{
public int tem = 0;
}private void MdiForm_Load(object sender, EventArgs e)
{
AButton b= new AButton ();
b.item=10;
this.Controls.Add(b);
}
此时 也可能赋值给 b,甚至于是 a 的另外一个实例。
有解吗?如果 button 是 a 的一个实例自己 new 出来的。
也确实需要这么做。
很简单,btn1 = new Button();
btn1.Tag = this;