C# 两个窗体中相互切换的方法
2020-12-13 04:07
标签:art cti for io 代码 line 注意将form2中的botton2的modyfier属性修改为public form1代码 form2代码 C# 两个窗体中相互切换的方法,搜素材,soscw.com C# 两个窗体中相互切换的方法 标签:art cti for io 代码 line 原文地址:http://www.cnblogs.com/swtool/p/3832379.html
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
{
public
partial
class
Form1 : Form
{
Form2 frm =
new
Form2();
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
this
.Hide();
frm.Show();
frm.button2.Click +=button2_Click;
}
private
void
button2_Click(
object
sender, EventArgs e)
{
MessageBox.Show(
"form1"
);
this
.Show();
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
}
}
}
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
{
public
partial
class
Form2 : Form
{
public
Form2()
{
InitializeComponent();
}
private
void
button2_Click(
object
sender, EventArgs e)
{
MessageBox.Show(
"form2"
);
this
.Hide();
}
}
}
上一篇:Java设计模式之享元模式
下一篇:合并两个排序的链表