窗体像QQ那样最小化到托盘 ,下面是代码 怎么不对啊, 是不是还需要设置什么属性啊? 高手给帮忙改下 private void MainForm_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
} private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (this.ShowInTaskbar == false)
notifyIcon1.Visible = true; this.ShowInTaskbar = true;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
{
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal;
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
} private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (this.ShowInTaskbar == false)
notifyIcon1.Visible = true; this.ShowInTaskbar = true;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
{
if (this.Visible)
{
this.Hide();
}
else
{
this.Show ();
this.WindowState = FormWindowState.Normal;
}
} private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
this.notifyIcon1.Visible = true;
}
}