Detect Right Click On Every PictureBox On The Form
<p>I'm wanting to detect a right click on any <code>PictureBox</code> in the form. I have already set up the right click function for one <code>PictureBox</code>. This is fine but I would like one event that will fire for all right clicks on <code>PictureBoxes</code> on the form. </p>

<p>This right click even will need to know the <code>PictureBox</code> name because the context menu will be different for some of the <code>PictureBoxes</code>. </p>

<p>Here is the code I have for the right click event for one <code>PictureBox</code>.</p>

<pre><code>private void DesktopIcon1Icon_MouseClick(object sender, MouseEventArgs e)
{
    switch (e.Button)
    {
        case MouseButtons.Right:
        {
            DesktopIconRightclick.Show(this, new Point(e.X, e.Y));
        }
        break;
    }
}
</code></pre>

<p>I need to adapt this code to fire if any <code>PictureBox</code> is right clicked. </p>

<p><strong>Example Update</strong></p>

<pre><code>if (pic = DesktopIcon2)
{
    openToolStripMenuItem.visible = false;
}
</code></pre>