NotifyIcon: Always Hide and Balloon Tip - Icon never shown RRS feed

  • Question

  • Hi everyone,


    During testing, a bug was discovered with my implementation of the NotifyIcon. 


    What we want is for an icon to appear in the systray and display a balloon tip with a message.  If nothing is done, after a while just disappear.  Everything works great, until you set the option to "Always Hide" in the properties of the systray.


    Then, when the ShowBalloonTip method is called it removes the icon from the systray.  If the method is never called, then the icon is hidden but is in the systray like how it should be.


    This is my code:


    Code Block

    m_Notify = new NotifyIcon();

    m_Notify.ContextMenuStrip = context;

    m_Notify.BalloonTipIcon = ToolTipIcon.Info;m_Notify.BalloonTipTitle = title;

    m_Notify.BalloonTipText = text;

    m_Notify.BalloonTipClicked += new EventHandler(m_notify_BalloonTipClicked);

    m_Notify.BalloonTipClosed += new EventHandler(m_notify_BalloonTipClosed);

    m_Notify.MouseClick += new MouseEventHandler(m_Notify_MouseClick);

    m_Notify.Text = title;

    m_Notify.Icon = m_Icon;

    m_Notify.Visible = true;

    // m_Notify.ShowBalloonTip(m_Timeout);


    Any help on this would be great! I can't find anything on this subject.






    Tuesday, November 13, 2007 2:18 PM


  • Hi ben2004uk


    Is there any thing wrong in your code? Because it works well on my machine. The following code is my example.


    Code Block

    public partial class MainForm : Form


        private NotifyIcon m_Notify;


        public MainForm()




            ContextMenuStrip menu = new ContextMenuStrip();

            menu.Items.Add("Menu 1");

            menu.Items.Add("Menu 2");


            m_Notify = new NotifyIcon();

            m_Notify.ContextMenuStrip = menu;

            m_Notify.BalloonTipIcon = ToolTipIcon.Info;

            m_Notify.BalloonTipTitle = "This is title";

            m_Notify.BalloonTipText = "This is text.";

            m_Notify.BalloonTipClicked += new EventHandler(m_Notify_BalloonTipClicked);

            m_Notify.BalloonTipClosed += new EventHandler(m_Notify_BalloonTipClosed);

            m_Notify.MouseClick += new MouseEventHandler(m_Notify_MouseClick);

            m_Notify.Text = "This is title";

            m_Notify.Icon = SystemIcons.Application;

            m_Notify.Visible = true;




        void m_Notify_MouseClick(object sender, MouseEventArgs e)




        void m_Notify_BalloonTipClosed(object sender, EventArgs e)




        void m_Notify_BalloonTipClicked(object sender, EventArgs e)






    Best Regards,
    Wei Zhou
    Friday, November 16, 2007 6:54 AM