private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (ifClose == true)
{
DialogResult result = MessageBox.Show("确定要关闭服务管理?", "提示消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
else
{
e.Cancel = true;
this.ShowInTaskbar = true; //显示在系统任务栏
this.WindowState = FormWindowState.Minimized; //还原窗体
this.Hide();
}
{
if (ifClose == true)
{
DialogResult result = MessageBox.Show("确定要关闭服务管理?", "提示消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
e.Cancel = false;
}
else
{
e.Cancel = true;
}
}
else
{
e.Cancel = true;
this.ShowInTaskbar = true; //显示在系统任务栏
this.WindowState = FormWindowState.Minimized; //还原窗体
this.Hide();
}
}
打开时: this.Visible = true;
this.ShowInTaskbar = true; //显示在系统任务栏
this.WindowState = FormWindowState.Normal; //还原窗体