can't perform middle click on a NotifyIcon

ms account 0 Reputation points

Hello. The problem is when the middle mouse has been clicked on the tray the program always sees it like the left one has been. Creating a new notifyIcon control gives the same result. There is the same problem in other projects. Middle click is normally detected in other cases (clicking on a picturebox).

        private void notifyIcon_Tray_MouseClick(object sender, MouseEventArgs e)
            if (e.Button == MouseButtons.Left) f_ShowMainWindow();
            if (e.Button == MouseButtons.Middle) Objects_and_Functions.f_OpenDraft();
Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,628 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiale Xue - MSFT 10,231 Reputation points Microsoft Vendor

    Hi @ms account , Welcome to Microsoft Q&A,

    After testing with the following code in Windows 10/11:

       private void notifyIcon1_MouseDown(object sender, MouseEventArgs e)

    In Windows 11, notifyIcon1_MouseDown seems to recognize the middle mouse button as the left button. I tested this function normally in Windows 11.

    It seems that you can do what you want by building a global hook, but that is very troublesome and unsafe. If there are no special needs, I suggest you use other methods (such as left click and right click, single click and double click, you have four combinations to use)

    Waiting for your reply.

    Best Regards,


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.