创建一个自定义控件
namespace testcontrolnull
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private entity e;
public entity E
{
get { return e; }
set { e = value; }
}
}
public class entity
{
private decimal myVar;
public decimal MyProperty
{
get { return myVar; }
set { myVar = value; }
}
}
}
使用该控件,将其拖动到某窗体时,会自动生成如下代码:
this.userControl11.E = null;
this.userControl11.Location = new System.Drawing.Point(182, 146);
this.userControl11.Name = "userControl11";
this.userControl11.Size = new System.Drawing.Size(57, 77);
this.userControl11.TabIndex = 0;
怎么让不产生 this.userControl11.E = null;
谢谢o(∩_∩)o...