Me.WindowState = FormWindowState.Normal Me.Show ( ) End Sub End Class ''''启动程序 Module Module1 Sub Main ( ) Application.Run ( new Form1 ( ) ) End sub End Module
''''开始托盘图标的转动
Private Sub MenuItem1_Click ( ByVal sender As System.Object ,
ByVal e As System.EventArgs ) Handles MenuItem1.Click
Timer1.Enabled = True
End Sub
''''停止托盘图标的转动
Private Sub MenuItem2_Click ( ByVal sender As Object ,
ByVal e As System.EventArgs ) Handles MenuItem2.Click
Timer1.Enabled = False
End Sub
''''关闭程序,清除托盘资源
Private Sub MenuItem3_Click ( ByVal sender As Object ,
ByVal e As System.EventArgs ) Handles MenuItem3.Click
NotifyIcon1.Dispose ( )
Application.Exit ( )
End Sub
''''根据标识符,来确定托盘图标类型
Private Sub Timer1_Tick ( ByVal sender As Object ,
ByVal e As System.EventArgs ) Handles Timer1.Tick
If BeginFlag = True Then
NotifyIcon1.Icon = Icon2
BeginFlag = False
Else
NotifyIcon1.Icon = Icon1
BeginFlag = True
End If
End Sub