How can I create my own events in my C # application like the default?

I needed to update the text value of the system tray icon, my application, whenever the user hovered over it. I noticed that there is no such event for system tray icons. Is it possible to create a hover event for the system tray icon, and if so, how can I execute it?

+1


a source to share


2 answers


How to connect to NotifyIcon.MouseMove

?

As a basic example, this works (from NotifyIcon

to a Form

):



    public Form1() {
        InitializeComponent();
        notifyIcon1.MouseMove += delegate
        {
            notifyIcon1.Text = DateTime.Now.TimeOfDay.ToString();
        };
        notifyIcon1.Icon = SystemIcons.Hand;
        notifyIcon1.Visible = true;            
    }

      

+5


a source


In WPF, UI elements have a ToolTipOpening / ToolTipClosing event. You have to update the tooltip text in the opening. I don't know if the system tray icon has this behavior, but I think there is something similar.



0


a source







All Articles