有那个控件
protected override void OnResize(EventArgs e)//重载这个方法,在你按最小化的时候就会隐藏
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = false;
}
}
private void Form1Xiaoshi()//一个让主窗体最小化
{
this.Visible = false;
this.WindowState = FormWindowState.Minimized;
}
private void Form1Xianshi()//一个让主窗体显示
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
}
}
如果要在右下角出现图标,那要拖一个notifyIcon控件到FORM中,然后在notifyIcon控件的MouseDoubleClick事件中加 下面的代码就可以了
private void Form1Xianshi()//一个让主窗体显示
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
}
}