日期:2014-05-17  浏览次数:20830 次

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 
好奇怪啊 
难道是  资料错了? 还是我错了? 

------解决方案--------------------
引用:
引用:没错,顺序是
Control.HandleCreated
 
Control.BindingContextChanged
 
Form.Load
 
Control.VisibleChanged
 
Form.Activated
 
Form.Shown

大侠 那我在窗体的对应方法里 都加了一句 消息框(me……


别用MessageBox.Show,在外面定义个string str
  private void F_UserAdd_Shown(object sender, EventArgs e)
        {
        str+="F_UserAdd_Shown\r\n";//都这样写
        }
然后加个button按钮,click事件里加断点看下str内容就知道了