mardi 31 mars 2015

Add image and value to a panel?

I was able to add image to my panel with the following code, but now my problem is i need to retrieve some information from the image etc(key value)


Is that possible to add in a value to every image ?so I can get it when I need



foreach (System.Drawing.Image img in imagelist)
{
PictureBox imagePicBox = new PictureBox();
imagePicBox.Name = "image" + imagePanel.Controls.Count.ToString();


imagePicBox.Image = img;




imagePicBox.Size = imagePicBox.Image.Size;
imagePicBox.BackColor = Color.Black;
imagePicBox.SizeMode = PictureBoxSizeMode.StretchImage;
imagePicBox.BorderStyle = BorderStyle.FixedSingle;


imagePanel.Controls.Add(imagePicBox);



}

Aucun commentaire:

Enregistrer un commentaire