我有一个用户控件,我在加载时添加到我的主窗体。我没有触及我的主表单的代码。但是我注意到我的用户控件的OnLoad()
事件被跳过了,不再被触发了。
这是我的用户控件的设计器代码位,其中用户控制Load
事件的订阅者:
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoSize = true;
this.Controls.Add(this.listviewMappings);
this.Controls.Add(this.lblMessage);
this.Controls.Add(this.btnAddMapping);
this.Controls.Add(this.comboTo);
this.Controls.Add(this.txtbxFrom);
this.Controls.Add(this.lblTo);
this.Controls.Add(this.lblFrom);
this.Controls.Add(this.lblAddNewMapping);
this.Controls.Add(this.lblCurrentMappings);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Lucida Sans", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ForeColor = System.Drawing.Color.DimGray;
this.Name = "UserControlMappingsFilesVsContacts";
this.Size = new System.Drawing.Size(940, 420);
this.Load += new System.EventHandler(this.UserControlMappingsFilesVsContacts_Load);
((System.ComponentModel.ISupportInitialize)(this.listviewMappings)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
这是我未加载的加载事件:
private void UserControlMappingsFilesVsContacts_Load(object sender, EventArgs e)
{
lblMessage.Text = string.Empty;
this.RefreshPropertiesCombo();
this.RefreshMappings();
}
请注意,我的用户控件的构造函数已运行,InitializeComponent()
方法显示控件。此外,我已启用Common Library Runtime Exceptions
但我没有收到任何内容。