none
Catch OnMouseClick (right mouse button) event on a simple Button Control RRS feed

  • Question

  • Hi,

    I am quite tired, so please help me to add the last brick to my daily wall..

    How to Catch OnMouseClick (1 click by right mouse button) event on a simple Button Control?

    T H A N K S



    • Edited by RobbKirk Thursday, August 1, 2019 11:35 AM
    Thursday, August 1, 2019 11:34 AM

Answers

  • I find it nicer to use the MouseUp event because this more closely resembles a button click (a button click only registers when releasing the left mouse button).

    Right, like for Context Menus for example
    • Marked as answer by RobbKirk Thursday, August 1, 2019 11:52 AM
    Thursday, August 1, 2019 11:49 AM

All replies

  •         private void button1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Right)
                {
                    Console.Beep(1000, 10);
                }
            }

    Thursday, August 1, 2019 11:41 AM
  • Hi,

    The answer from Castorix31 should work, but I find it nicer to use the MouseUp event because this more closely resembles a button click (a button click only registers when releasing the left mouse button).

    Kind regards,

    Johnny Hooyberghs

    Thursday, August 1, 2019 11:46 AM
  • I find it nicer to use the MouseUp event because this more closely resembles a button click (a button click only registers when releasing the left mouse button).

    Right, like for Context Menus for example
    • Marked as answer by RobbKirk Thursday, August 1, 2019 11:52 AM
    Thursday, August 1, 2019 11:49 AM
  • Yeah, I ve already done it with mouseUp.. thanks
    • Edited by RobbKirk Thursday, August 1, 2019 11:51 AM
    Thursday, August 1, 2019 11:51 AM