using System;
using System.Drawing;
using System.Windows.Forms;

namespace Window{
class Window{
static void Main(){
Application.Run(new Init());
}
}

class Init:Form{
public Init(){
Text = "继承自Form的窗口";
BackColor = Color.White;

Button btn = new Button();
btn.Width = 150;
btn.Text = "你好";
btn.Location = new Point(80,50);
btn.Click += new EventHandler(this.btn_Click);

Controls.Add(btn);
}

private void btn_Click(object sender,EventArgs e){
MessageBox.Show("我是button事件点击出来的弹窗","我是弹窗的标题");
}
}
}
都是为了最简化的去运行一个程序,让刚開始学习的人能一步到位的了解为什么这么写和为什么要这么写