当应用程序在visual basic 2010中关闭时,NotifyIcon会保留在任务栏上

时间:2009-12-06 16:33:23

标签: vb.net

当应用程序关闭时,NotifyIcon会停留在任务栏上,然后当我将鼠标移到它上面时,它会消失。

我在关机时试过这个,

Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
    Form2.NotifyIcon1.Visible = False
    Form2.NotifyIcon1.Dispose()
End Sub

它仍然存在,对此有何建议?

感谢

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

对我来说,在设置Application.DoEvents()Icon之后调用null并处置NotifyIcon时,它会有效。

Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
    Form2.NotifyIcon1.Icon = Nothing;
    Form2.NotifyIcon1.Dispose()
    System.Windows.Forms.Application.DoEvents()
End Sub