NotifyIcon

Snookie

Active member
Joined
Dec 13, 2010
Messages
29
Programming Experience
Beginner
Hey all.

I have this code :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Call SetIcon()
End Sub

Private Sub SetIcon()
Dim bmp As Bitmap = New Bitmap(16, 16, System.Drawing.Imaging.PixelFormat.Format24bppRgb)
Dim g As Graphics = Graphics.FromImage(bmp)
If Now.Second() Mod 2 = 0 Then
g.FillRectangle( Brushes.White, 0, 0, 16, 16)
g.FillRectangle(Brushes.Black, 4, 4, 8, 8)
Else
g.FillRectangle(Brushes.Black, 0, 0, 16, 16)
g.FillRectangle(Brushes.White, 4, 4, 8, 8)
End If
NotifyIcon1.Icon = Drawing.Icon.FromHandle(bmp.GethIcon)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call SetIcon()
End Sub


Its work , but i have a question.
How i change the icon to this
NotifyIcon1.Icon = New Icon(Application.StartupPath & "\icon1.png")
NotifyIcon1.Icon = New Icon(Application.StartupPath & "\icon2.png")

Or to this.
NotifyIcon1.Icon = New Icon(Application.StartupPath & "\icon1.ico")
NotifyIcon1.Icon = New Icon(Application.StartupPath & "\icon2.ico")

I dont care its a : .ico - .png - .gif or what it could be.

Cant some one tell me how i change it.. in this code or differences code
 
Top Bottom