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

this.Load += new System.EventHandler(this.Form1_Load)功用详解

2012-09-11 
this.Load + new System.EventHandler(this.Form1_Load)作用详解?namespace message{public partial clas

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中去。

热点排行