Results 1 to 8 of 8

Thread: SysTray Icon Help

  1. #1

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    SysTray Icon Help

    is there any easy way to display animated gif in sys tray ?

    or do i have to draw a simple picture/shape using GDI ?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: SysTray Icon Help

    As the name suggests, the NotifyIcon displays an Icon. If you want animation then you would intermittently change the Icon that is displayed. An animated GIF is simply a set of frames that get displayed on after the other. You can do that manually with multiple Icons. You could even derive your own custom NotifyIcon that allowed you to set a collection of icons and an interval and will then change its own Icon.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: SysTray Icon Help

    Apparently NotifyIcon is NotInheritable so you can forget that last suggestion.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Question Re: SysTray Icon Help

    actually i was looking for something like this :

    http://www.vbforums.com/showthread.p...ighlight=clock

    but not that complicated, i dnt want to write huge code for GUI , whtever i can do in design mode is good.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: SysTray Icon Help

    And what does that project do? It creates a NotifyIcon and changes the Icon at run time, exactly as I said. How the icons are created is irrelevant to that fact. If you want to draw the Icons yourself then by all means do so.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Re: SysTray Icon Help

    ok sorry for not explaining in details earlier...here it goes...

    my little tool launches a url in new IE window when i click a button & waits till the page is loaded , so i simply wanna animate the systray icon i have added till the page is completely loaded.

    According to u wht shud the eaisiest way to do that ? do i add series of icons in my resources & keeps them changing sequentially in a loop adding a delay, or is there a better way u can think of , like a said i do not want a too complicated code for this since i need to keep the file size in KB's & the tool is not that big in itself .

    thx already ! =)

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: SysTray Icon Help

    Add the Icons on the Resources page of the project properties. Add a Timer to your form with the appropriate Interval. Code like this:
    vb.net Code:
    1. Private icons As Icon() = {My.Resources.Icon1, My.Resources.Icon2, My.Resources.Icon3}
    2. Private iconIndex As Integer = 0
    3.  
    4. Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
    5.     Me.iconIndex = (Me.iconIndex + 1) Mod Me.icons.Length
    6.     Me.NotifyIcon1.Icon = Me.icons(Me.iconIndex)
    7. End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Resolved Re: SysTray Icon Help

    awesome ... u saved by coding time for that jmcilhinney

    thx a ton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width