2

I'm trying to create a balloontip (windows popup) and want to know if the user clicks on it. But I can't catch the click.

I've already tried a few things but it won't work.

notification.ShowBalloonTip(5000);          
notification.BalloonTipClicked += new System.EventHandler(this.OpenWindow);
notification.Click += new System.EventHandler(this.OpenWindow);
notification.DoubleClick += new System.EventHandler(this.OpenWindow);

The notification is a NotifyIcon object. I hope someone here can help me with this.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
D. J.
  • 684
  • 6
  • 25
  • Did you try using MessageBox? With the help of DialogResult? – Aditi Feb 16 '17 at 10:16
  • Thanks for the reply. I did try using a MessageBox, but it just won't open the function. I think it does jump over it. And I have no idea how to solve that. – D. J. Feb 16 '17 at 10:36
  • What are you targetting: Winforms, WPF, ASP..? __Always__ tag your question correctly! – TaW Feb 16 '17 at 11:37
  • Actually the code works fine for the `BalloonTipClicked` event. Do not forget to set `notification.Visible = true;` and, obviously the `BalloonTipText`; also the `Icon`, maybe `notification.Icon = System.Drawing.SystemIcons.Information;`.. – TaW Feb 16 '17 at 11:45

1 Answers1

1

There where multiple things I had to do. I needed notification.BalloonTipClicked to verify I've clicked on the balloon.

Also, afther that line of code I had a notification.dispose function to remove the icon. But this was comming to fast, so the notification was disposed before I could click on it.

The solution to save that problem was to set the visibility to false.

After that it worked fine!

D. J.
  • 684
  • 6
  • 25