Form窗体的生命周期
在资料上看到顺序是这样的:
System.Windows.Forms.Control.HandleCreated
System.Windows.Forms.Control.BindingContextChanged
System.Windows.Forms.Form.Load
System.Windows.Forms.Control.VisibleChanged
System.Windows.Forms.Form.Activated
System.Windows.Forms.Form.Shown
但是当我自己实验时确是这样的:
System.Windows.Forms.Form.Load
System.Windows.Forms.Form.Shown
System.Windows.Forms.Control.VisibleChanged
System.Windows.Forms.Form.Activated
好奇怪啊
难道是 资料错了? 还是我错了?
------解决方案--------------------
别用MessageBox.Show,在外面定义个string str
private void F_UserAdd_Shown(object sender, EventArgs e)
{
str+="F_UserAdd_Shown\r\n";//都这样写
}
然后加个button按钮,click事件里加断点看下str内容就知道了