i have generated picturebox dynamically… now i have to displaying Different images on that picture boxes after that when i click the particular picture box it should be displayed in the next form Picture box…. how do i know the particular picturebox got clicked…. and How can I do it… reply me.. Thanks In Advance..
and my coding is
for(int i=0;i<Num_Picbox;i++)
{
shapes[i].Location = new Point(Left,Top);
Left += 200;
Top += i + 0;
shapes[i].Size = new Size(150, 150);
shapes[i].BackColor = Color.Black;
shapes[i].Visible = true;
shapes[i].BorderStyle = BorderStyle.FixedSingle;
this.Controls.Add(shapes[i]);
shapes[i].Click += new EventHandler(PictureBox_Click);
}
private void PictureBox_Click(object sender, EventArgs e)
{
int imageid = 1;
ClsProperty.ImageId = imageid;
fd2 = new frmImageDisplay(imageid, ClsProperty.ipaddress);
fd2.Show();
}
The “sender” in the event handler will be the picture box that got clicked: