1.文件-新建-项目-VisualC#-Windows应用程序
2.解决方案管理器 右键单击Form1.cs,查看代码
3. InitializeComponent();右键-转到定义,并添加
this.Load +=new System.EventHandler(Form2_Load);
this.Resize +=new System.EventHandler(Form2_Resize);
4.在Form1.cs代码编辑器里,添加
private void Form2_Load(object sender, System.EventArgs e)
{
MessageBox.Show("1");
}
private void Form2_Resize(object sender, System.EventArgs e)
{
txtWidth.Text = this.Size.Width.ToString();
txtHeight.Text = this.Size.Height.ToString();
}
5.其他的事件以此类推,在视图-对象浏览器里,查找各种事件,并添加