this.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; //Shows the info icon so the user doesn't think there is an error.
this.notifyIcon.BalloonTipText = "[Balloon Text when Minimized]";
this.notifyIcon.BalloonTipTitle = "[Balloon Title when Minimized]";
this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon"))); //The tray icon to use
this.notifyIcon.Text = "[Message shown when hovering over tray icon]";
9 回答
this.WindowState = FormWindowState.Minimized;
我发现这可以完成整个解决方案 . 上面的答案无法从任务栏中删除窗口 .
最好使用表单设计器设置通知图标控件的以下属性 .
...并为您的右键单击通知菜单向表单添加上下文菜单并编辑它,并通过双击它们为每个上下文菜单设置鼠标点击事件,然后通过选择notifyicon属性中的ContextMenuStrip将其附加到notifyicon1 .
不要忘记将图标文件添加到您的notifyIcon,否则它不会出现在托盘中 .
这是我在我的应用程序中使用的方法,它相当简单和自我解释但我很乐意提供更多细节来回答您的意见 .
单击系统托盘中的图像,您可以验证框架是否可见,然后您必须设置Visible = true或false
C# System Tray Minimize To Tray With NotifyIcon
Minimize window to system tray
我会去的
试试这个