110,546
社区成员
发帖
与我相关
我的任务
分享
private void Form1_Load(object sender, EventArgs e)
{
notifyIcon1.ShowBalloonTip(5000, "提示信息", "提示信息", ToolTipIcon.Info);
notifyIcon1.Visible = true;
MenuItem menuItem1 = new MenuItem("显示");
MenuItem menuItem2 = new MenuItem("隐藏");
menuItem1.Click += new EventHandler(menuItem1_click);
menuItem2.Click += new EventHandler(menuItem2_click);
notifyIcon1.ContextMenu = new ContextMenu(new MenuItem[] { menuItem1, menuItem2 });
//this.Hide();
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}
private void menuItem1_click(object sender, EventArgs e)
{
if (this.ShowInTaskbar == false)
{
this.ShowInTaskbar = true;
this.WindowState = FormWindowState.Normal;
}
else
{
this.Show();
}
}
private void menuItem2_click(object sender, EventArgs e)
{
this.Hide();
}