public void displayImage(KeyValuePair <string, Bitmap> kvp) { PictureBoxExtra tmp = new PictureBoxExtra(); tmp.BackgroundImage = global::pwsg_Lab3.Properties.Resources.NoImage; tmp.Location = new System.Drawing.Point(3, 3); tmp.Name = "pictureBox11"; tmp.Size = new System.Drawing.Size(150, 150); tmp.Image = kvp.Value; tmp.filePath = kvp.Key; tmp.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; tmp.MouseClick += Tmp_MouseClick; flowLayoutPanel.Controls.Add(tmp); }
private void Tmp_MouseClick(object sender, MouseEventArgs e) { PictureBoxExtra curr = sender as PictureBoxExtra; System.Console.Out.WriteLine(curr.filePath); }