Issue with NotifyIcon not disappearing on Winforms App

前端 未结 7 1838
暗喜
暗喜 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:49

    Have you overridden the dispose method of the object where you've initialised the notifyIcon to also dispose the notifyIcon?

    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            notifyIcon.Dispose();
            notifyIcon = null;
        }
        base.Dispose(disposing);
    }
    

提交回复
热议问题