which PictureBox was clicked?

  • Thread starter Thread starter John McD
  • Start date Start date
J

John McD

Hi,

I have 64 pictureboxes that all use the same MouseDown
function. How can I detect which picturebox has been
clicked upon? Can I add an extra parameter to the Event
function?

TIA...John.

gridCell[count].MouseDown += new
MouseEventHandler(gridCell_MouseDown);
...
...
...
private void gridCell_MouseDown(object sender,
MouseEventArgs e)
{
this.textBox1.Text = sender.ToString();
}
 
Cast the 'sender' argument to a PictureBox reference. That's the control
that is generating the event.
 
Hi John!

I have 64 pictureboxes that all use the same MouseDown
function. How can I detect which picturebox has been
clicked upon? Can I add an extra parameter to the Event
function?

Sorry - This isn't possible. Maybe it is ok to calculate, in which
pictureBox the mouse is?

With kind regards,

Konrad
 
Back
Top