public ComboxSex()
{
try
{
this.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.FormattingEnabled = true;
this.Items.AddRange(new object[] { "男", "女" });
//label = new System.Windows.Forms.Label();
//label.Text = "性别";
//this.Controls.Add (label); this.TextChanged += new EventHandler(ComboxSex_TextChanged);
}
catch (Exception ex)
{
throw ex;
}
}
当在窗体 画此控件的时候。
this.comboxSex1 = new WindowsControlLibrary2.ComboxSex();
this.SuspendLayout();
//
// comboxSex1
//
this.comboxSex1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboxSex1.FormattingEnabled = true;
this.comboxSex1.Items.AddRange(new object[] {
"男",
"女"});
new 的时候执行了一次。
为什么会出红色的代码。如何取消。
{
try
{
this.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.FormattingEnabled = true;
this.Items.AddRange(new object[] { "男", "女" });
//label = new System.Windows.Forms.Label();
//label.Text = "性别";
//this.Controls.Add (label); this.TextChanged += new EventHandler(ComboxSex_TextChanged);
}
catch (Exception ex)
{
throw ex;
}
}
当在窗体 画此控件的时候。
this.comboxSex1 = new WindowsControlLibrary2.ComboxSex();
this.SuspendLayout();
//
// comboxSex1
//
this.comboxSex1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboxSex1.FormattingEnabled = true;
this.comboxSex1.Items.AddRange(new object[] {
"男",
"女"});
new 的时候执行了一次。
为什么会出红色的代码。如何取消。
我也有点糊涂