Click to See Complete Forum and Search --> : NotifyIcon Bug?


fallnwrld
July 14th, 2008, 01:57 PM
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.

javajawa
July 14th, 2008, 02:38 PM
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.

javajawa
July 14th, 2008, 03:21 PM
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:

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:
If Me.WindowState = FormWindowState.Minimized Then Exit Sub

Hope this is a) accurate (I'm looking to you, gurus :D) and b) helpful!