winform 隐藏界面模块
打开界面时的隐藏,写于Form_A界面,要打开的是Form_B界面
Form_A界面中在触发事件里这样写:
private void button1_Click(object sender, EventArgs e)
{
try
{
Form_B B = new Form_B(this);
this.Hide();
B.Show();
//this.Close();
}
catch (Exception ex)
{
throw ex;
}
}
Form_B界面中,在public partial class内添加/修改以下内容,其中初始化窗口部分可要可不要,要在FormB关闭时触发的内容,最好从界面的触发绑定处添加,而不是直接复制该程序
private Form_A returnFormA = null;
public get_data(Form_A FA)
{
InitializeComponent();
#region 初始化窗口
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.StartPosition = FormStartPosition.CenterParent;
#endregion
this.returnForm1 = FA;
}
private void FormB_FormClosing(object sender, FormClosingEventArgs e)
{
//恢复FormA
this.returnFormA.Visible = true;
}

浙公网安备 33010602011771号