3

On my form I have a notifyIcon. I have handlers for both Click & BalloonTipClicked bound to the notifyIcon. Now, if the balloon is showed and I click on the notifyIcon the BalloonTipClicked gets fired and after that the Click fires. I'm not sure if this is intended behaviour but I only want to have the Click fired, how can I achieve that?

private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
{
    Console.WriteLine("notifyIcon balloontip click"); // This fires first
}

private void notifyIcon1_Click(object sender, EventArgs e)
{
    Console.WriteLine("notifyIcon click"); // This fires after balloontipclick
}

notifyIcon

A1rPun
  • 16,287
  • 7
  • 57
  • 90
  • @RezaAghaei Interesting.. do I need to specify additional details about my dev setup? – A1rPun Nov 13 '16 at 16:38
  • I see it, Win10 specific bug. Version might matter, I've got 1607. I get the BalloonTipClicked when clicking on the icon but *not* the Clicked event. So the recommendation in the answer isn't going to work. Nothing is going to work around this, all you can do is post the bug to connect.microsoft.com. With some luck they'll pass it on to the Windows group. – Hans Passant Nov 13 '16 at 17:02
  • @HansPassant Thanks for your reply, on my private win10 VS2k15 setup both the balloontipclick & click *DO* fire. I'm sure it occurs on multiple win10 setups @ work too. It might be version specific and I will try my luck @ connect.microsoft.com. – A1rPun Nov 13 '16 at 17:30
  • @RezaAghaei I created a [Minimal, Complete, and Verifiable example](https://github.com/A1rPun/NotifyIconBug) @ github. – A1rPun Nov 13 '16 at 17:43
  • 1
    @A1rPun I can confirm the Issue on WIN8.1 – Reza Aghaei Nov 13 '16 at 21:20

1 Answers1

1

It is not best practice but you can add a boolean variable. And on notifyicon.mousehover event set this variable to false. And on baloontipclick check if that variable is false exit sub else the sub will be executed

Hadi
  • 36,233
  • 13
  • 65
  • 124
  • Thanks for answering, I hope there is a cleaner solution but otherwise I could always go for workaround. – A1rPun Nov 13 '16 at 16:39