How to detect a Right Click event in Visual studio?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 05:03:16

You can use the mouse_down event and check if it is a right-click

Private Sub PictureBox1_MouseDown(Byval sender As Object, Byval e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown

    If e.Button = MouseButtons.Right Then
        MsgBox("Right Button Clicked")
    End If

End Sub

refer to this http://www.homeandlearn.co.uk/net/nets10p2.html

For those beginner C# programmers out there, this is an example written in C# for your extra information.

private void PictureBox1_MouseDown(object sender, MouseEventArgs e)
{
    if(e.Button == MouseButtons.Right)
    {
        MessageBox.Show("Right Click");
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!