日期:2014-05-18  浏览次数:21673 次

this.Load += new System.EventHandler(this.Form1_Load)作用详解?
namespace message
{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent();
  this.Load += new System.EventHandler(this.Form1_Load);
  }
  private void Form1_Load(object sender, EventArgs e)
  {
  MessageBox.Show("hellowindows!");
  }
  }

}
如题,没这话,好像程序就不能用,有其他可以代替的吗?

------解决方案--------------------
这个是把Form1_Load添加到委托中去(委托是什么,可以去网上搜索)
 如果不想写这句this.Load += new System.EventHandler(this.Form1_Load);
你可以去Form1窗体的事件中找到Load事件,双击进去写代码.
双击进去就直接写MessageBox.Show("hellowindows!"); 
程序会自动添加委托,你就不需要自己加了
------解决方案--------------------
将 this.Load的事件,委托到方法this.Form1_Load中去。