第1个回答 2013-04-12
#region 窗体最小化到状态栏
private void MainForm_FormClosing(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{ e.cancel= true; //取消关闭窗体事件
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
} private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) //双击最小化图标显示窗体
{
if (this.ShowInTaskbar == false)
{
notifyIcon1.Visible = true;
this.ShowInTaskbar = false;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
}本回答被网友采纳
第2个回答 2013-04-12
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("是缩小到托盘?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
//你的最小化程序...这样就可以 e.Cancel = true;
}
}
第3个回答 2013-04-12
在点击事件里面写,this.WindowState=Minimized,复制进去就可以了。
第4个回答 2013-04-12
在关闭事件中写 取消关闭,然后最少华。