111,126
社区成员
发帖
与我相关
我的任务
分享
//Form2代码,只有按钮的代码有用,就给你按钮的代码吧
private void button1_Click(object sender, System.EventArgs e)
{
Form1.f3 = new Form3();
Form1.f3.Show();
}
//Form3代码 只是按钮代码
private void button1_Click(object sender, System.EventArgs e)
{
Form1.f2.Close();
Form1.f3.Close();
Form1.f1.Show();
}
private void button2_Click(object sender, System.EventArgs e)
{
Form1.f3.Close();
}
//Form1代码
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
public static Form2 f2;
public static Form3 f3;
public static Form1 f1;
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows フォーム デザイナ サポートに必要です。
//
InitializeComponent();
//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
}
/// <summary>
/// 使用されているリソースに後処理を実行します。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows フォーム デザイナで生成されたコード
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(208, 40);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 56);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
this.ClientSize = new System.Drawing.Size(292, 272);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// </summary>
[STAThread]
static void Main()
{
f1 = new Form1();
Application.Run(f1);
}
private void button1_Click(object sender, System.EventArgs e)
{
f2 = new Form2();
f2.Show();
this.Hide();
}
}