Need Help Only Need Help Only - 2 years ago 123 Question

Display message when application is minimized to the system tray?

Is there a way to display a message tip on the system tray icon when you minimize your application to the system tray?

Answer Source
  1. Use the Resize event.

Use this event to detect changes in the size of your form. When the form is minimized to the tray, the WindowState property will be set to FormWindowState.Minimized.

  1. Show the balloon-tip

When the form is minimized, you can call the method ShowBalloonTip on your notify-icon.

Here's an example:

Private Sub OnResize(ByVal sender As Object, ByVal args As EventArgs) Handles Me.Resize

    If WindowState = FormWindowState.Minimized Then

        'To hide the form

        'This line does the magic (parameters: timeout in ms, title, text, icon)
        MyNotifyIcon.ShowBalloonTip(3000, "MyApp", "The app was minimized", ToolTipIcon.Info)

    End If

End Sub
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download