Issue with NotifyIcon not disappearing on Winforms App

前端 未结 7 1834
暗喜
暗喜 2020-12-16 17:38

I\'ve got a .Net 3.5 C# Winforms app. It\'s got no GUI as such, just a NotifyIcon with a ContextMenu.

I\'ve tried to set the NotifyIcon to visible=false and dispose

7条回答
  •  盖世英雄少女心
    2020-12-16 17:57

    This code worked for me

    this.Closed += (a, b) =>
                {
                    if (notifyIcon1 != null)
                    {
                        notifyIcon1.Dispose();
                        notifyIcon1.Icon = null;
                        notifyIcon1.Visible = false;
                    }
                };
    

提交回复
热议问题