Multiple icons open in tray bar

我的未来我决定 提交于 2019-12-24 03:06:31

问题


I am working on a Windows application, and when I run this application, there are multiple icons appearing on the tray bar:

and when I mouse-over these icons, they disappear.

Does anybody have any idea why this is happening?

protected override void OnClosed(EventArgs e)
{
    try
    {
        notifyIcon1.Visible = false;
        notifyIcon1.Icon.Dispose();
        notifyIcon1.Dispose();
    }
    catch(Exception ex)
    {
    }
    base.OnClosed(e);
    Environment.Exit(0);
}

回答1:


Here is how I close my system tray icon to bring up the full application in a program I wrote a while back:

NOTE: this fits well in an event handler in the code behind, hence this.Show() and this.Activate()

            NotifyIcon sysTrayIcon = sender as NotifyIcon;
            sysTrayIcon.Visible = false;
            this.WindowState = WindowState.Normal;
            this.Show();
            this.Activate();


来源:https://stackoverflow.com/questions/13320747/multiple-icons-open-in-tray-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!