I have a button on a form and want to handle both left and right clicks.
I am handling the MouseClick event, but this is only raised on a left click.
Is this a problem somewhere in my code (a setting that I have missed) or the intended functionality?
If this is not possible to fix, what is the best workaround - to handle the MouseUp event?
The reason I would like to use MouseClick is so that double clicks are automatically recognised.
Thanks for any feedback.
Use MouseUp !!
private void button6_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
MessageBox.Show("LEFT");
}
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
MessageBox.Show("RIGHT");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With