110,529
社区成员
发帖
与我相关
我的任务
分享
private void form1_FormClosing(object sender, FormClosingEventArgs e)
{
if ((MessageBox.Show("确认退出吗?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
{
//这里做窗体退出的事情,比如你退出是要隐藏那么
//系统托盘显示图标
this.notifycon1.Visible = true;//notifycon1是一个控件LZ在工具箱里面就能找到,图片格式是ico格式的
//隐藏主界面
this.Visible = false;
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
Form2 f2 = new Form2();
f2.WindowState = FormWindowState.Maximized;
f2.Show();
this.Hide();
Form form2 = new Form2();
form2.ShowDialog();
this.Hide(); //form1隐藏