NotifyIcon.BalloonTipClicked event and mouse buttons
Asked Answered
T

1

5

I've got a NotifyIcon that signals downloadable application updates. I want the download page to open on a Left Click on the NotifyIcon and on a Left Click on the NotifyIcon balloon (on screen for 10 seconds).

However, when I handle the BalloonTipClicked event I can't figure out if it was a Left or a Right click. Thus, while the balloon is still on screen and the user Right clicks on the icon, I get both the popup menu and the download page opening.

How do I detect the Right mouse button was used?

Truong answered 19/8, 2010 at 11:39 Comment(2)
I don't think it's possible to distinguish left or right mouse button in this case. See a similar question here: social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/…Amalburga
Well, thanks I suppose. Bit of a let-down though...Truong
P
7

You could try testing the mouse state with code like this:

    private void notifyIcon1_BalloonTipClicked(object sender, EventArgs e) {
        if ((Control.MouseButtons & MouseButtons.Right) == MouseButtons.Right)
            MessageBox.Show("Right button clicked");
    }

I cannot test it on my machine with Win7, right-clicking the balloon just dismisses it and displays the context menu of the taskbar. Which is your ultimate nemesis I'd say.

Pryor answered 19/8, 2010 at 14:8 Comment(1)
Ahh of course. The Clicked event is raised /before/ the mouse button state goes back to none. Thanks!Truong

© 2022 - 2024 — McMap. All rights reserved.