Handling a click over a balloon tip displayed with TrayIcon's ShowBalloonTip()

后端 未结 2 493
囚心锁ツ
囚心锁ツ 2020-12-20 15:37

I use the ShowBalloonTip method of a TrayIcon class to display a balloon tip. Is there a way to handle a click over this balloon?

When I cl

相关标签:
2条回答
  • 2020-12-20 16:09

    Have you tried the following snippet? I managed to find it whilst doing a quick google search:

    private void TrayNotifyIcon_BalloonClick(object sender, EventArgs e)
    {
        //Perform Action
    }
    

    Obviously you'll need to make sure you specify the correct name in the method signature for your own application.

    I think this was written in an older version of the .Net Framework and there's probably a newly named method for it.

    Source: Build a C# Notification System

    0 讨论(0)
  • 2020-12-20 16:14

    I think you mean NotifyIcon . Use following pattern...

    NotifyIcon notifyIcon = null;
    public Form1()
    {
        InitializeComponent();
        notifyIcon = new NotifyIcon();
        // Initializing notifyIcon here...
        notifyIcon.BalloonTipClicked += new EventHandler(notifyIcon_BalloonTipClicked);
    }
    
    void notifyIcon_BalloonTipClicked(object sender, EventArgs e)
    {
        // Operation you want...
    }
    

    I hope it feed your needs...

    0 讨论(0)
提交回复
热议问题