title: Delete transparent background from picturebox in winforms c#
body: <p>I want to get the x,y location on click over a picturebox.I have 2 pictureboxes and one is over the other.The small picturebox has a transparent region background(.png).
  I want to get the second's picturebox when I click on this area.</p>
  
  <p>this is the code getting the x,y position:</p>
  
  <pre><code>  pictureBox2.MouseClick += (s, e) =&gt;
          {
              if (e.Button == MouseButtons.Right)
              {
                  MessageBox.Show(String.Format("Right Clicked2 at X: {0} Y: {1}", e.X, e.Y));
              }
              else if (e.Button == MouseButtons.Left)
              { MessageBox.Show(String.Format("Mouse Clicked2 at X: {0} Y: {1}", e.X, e.Y)); }
          };
  
          pictureBox1.MouseClick += (s, e) =&gt;
          {
              if (e.Button == MouseButtons.Right)
              {
                  MessageBox.Show(String.Format("Right Clicked at X: {0} Y: {1}", e.X, e.Y));
              }
              else if (e.Button == MouseButtons.Left)
              { MessageBox.Show(String.Format("Mouse Clicked at X: {0} Y: {1}", e.X, e.Y)); }
          };
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/esgrk.jpg" alt="enter image description here"></p>
  
  <p>with this code the second image shown(good showing).But when I cleck to the transparent area it gives me the message from the picturebox2 and not the picturebox1.Any idea how can assign this area to picturebox1?</p>
  
  <pre><code>     var pos = this.PointToScreen(pictureBox2.Location);
          pos = pictureBox1.PointToClient(pos);
          pictureBox2.Parent = pictureBox1;
          pictureBox2.Location = pos;
          pictureBox2.BackColor = Color.Transparent;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/0wlxw.jpg" alt="enter image description here"></p>