Bitmap originalImg; private void listView1_SelectedIndexChanged(object sender, EventArgs e) { for (int i = 0; i < listView1.Items.Count; i++) { if (listView1.Items[i].Selected == true) { originalImg = new Bitmap(folderPath + "/" + listView1.Items[i].SubItems[0].Text); } } pictureBox1.Image = tempImg; }
Bitmap originalImg, tempImg; private void listView1_SelectedIndexChanged(object sender, EventArgs e) { for (int i = 0; i < listView1.Items.Count; i++) { if (listView1.Items[i].Selected == true) { tempImg = new Bitmap(folderPath + "/" + listView1.Items[i].SubItems[0].Text); } } originalImg = (Bitmap)tempImg.Clone(); tempImg.Dispose(); OriginalPictureBox.Image = originalImg; } }