CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: NotifyIcon Bug?

  1. #1
    Join Date
    Mar 2003
    Posts
    95

    NotifyIcon Bug?

    Even thought I have ShowInTaskBar = false, when I minimize my form it goes into SystemTray like it is suppose to, but the Window minimizes over the Task Bar on the Bottom Left.
    Using VB .Net 2008 Express Edition

  2. #2
    Join Date
    Aug 2005
    Location
    Imperial College London, England
    Posts
    490

    Re: NotifyIcon Bug?

    I must confess I haven't looked at the way that Notify Icon works in VB.NET yet, but if it's like in VB6, then the form doesn't not actually minimise to the system tray - the best bet is to hide it when it is minimised...
    I'll just have a quick play around (coincidentially, it's the next thing I need to do on my current project), and see if there's a neater way of doing it.
    Last edited by javajawa; July 14th, 2008 at 02:41 PM.
    Help from me is always guaranteed!*
    VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
    Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.

    *Guarantee may not be honoured.

  3. #3
    Join Date
    Aug 2005
    Location
    Imperial College London, England
    Posts
    490

    Re: NotifyIcon Bug?

    as I thought, this isn't a bug - by default, a form cannot actually minimise to the system tray (although I suspect the gurus can tell us hundreds of ways to make it so...). The solution I use is:
    Code:
            Private Sub cmdMinimise_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdMinimise.Click
                    Me.WindowState = FormWindowState.Minimized
                    Me.Visible = False
            End Sub
    
            Private Sub mnuRestore_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuRestore.Click
                    Me.Visible = True
                    Me.WindowState = FormWindowState.Normal
            End Sub
    Don't make the silly mistake with resize code I did when testing this: Always good to catch the fact the form will be too small to give everything a positive height with:
    Code:
    If Me.WindowState = FormWindowState.Minimized Then Exit Sub
    Hope this is a) accurate (I'm looking to you, gurus ) and b) helpful!
    Help from me is always guaranteed!*
    VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
    Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.

    *Guarantee may not be honoured.

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

Featured