using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace test_csharp
{
public partial class Form1 : Form
{
public delegate void openForm(object o,EventArgs e);//第一步
public openForm eventOpenForm;//第二步
public Form2 newForm=new Form2();//需要打开的窗体
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//this.Close();
this.newForm.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
eventOpenForm +=button1_Click; //订阅事件
}
}
}