首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

Form窗体的生命周期解决办法

2013-01-18 
Form窗体的生命周期在资料上看到顺序是这样的:System.Windows.Forms.Control.HandleCreated System.Window

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内容就知道了

热点排行