急!如何最小化到托盘
一个Form窗体程序,如何在运行时最小化到托盘
程序代码:private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.ShowInTaskbar = false;
this.Hide();
this.notifyIcon1.Visible = true;
this.notifyIcon1.Icon = new Icon(@"C:\icon.ico");
this.notifyIcon1.ShowBalloonTip(3000);
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
this.Show();
this.notifyIcon1.Visible = false;
}在窗体上拖一个notifyIcon控件
