//*************************************************************************
// class FormMain
//*************************************************************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new FormMain());
}
}
}
//*************************************************************************
// class FormA
//*************************************************************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Bigthomas.twoForms
{
/// <summary>
/// FormA 的摘要说明。
/// </summary>
public class FormA : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnShowB;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FormA()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnShowB = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnShowB
//
this.btnShowB.Location = new System.Drawing.Point(48, 72);
this.btnShowB.Name = "btnShowB";
this.btnShowB.Size = new System.Drawing.Size(192, 32);
this.btnShowB.TabIndex = 0;
this.btnShowB.Text = "ShowB&&CloseA";
this.btnShowB.Click += new System.EventHandler(this.btnShowB_Click);
//
// FormA
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.btnShowB);
this.Name = "FormA";
this.Text = "FormA";
this.ResumeLayout(false);
}
#endregion
private void btnShowB_Click(object sender, System.EventArgs e)
{
FormB fb=new FormB();
fb.Show();
this.Close();
}
}
}
//*************************************************************************
// class FormB
//*************************************************************************
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;