private void previewToolStripMenuItem_Click(object sender, EventArgs e) { int index = dataGridView1.CurrentRow.Index; Image image = images[index]; using (Preview preview = new Preview(image, images)) { if (preview.Ok) { preview.ShowDialog(this); } } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } Image image = images[e.RowIndex]; using (Preview preview = new Preview(image, images)) { if (preview.Ok) { preview.ShowDialog(this); } } }
private void previewToolStripMenuItem_Click(object sender, EventArgs e) { List <Image> images = items.Select(x => x.image).ToList(); System.Drawing.Image[] realImages = new System.Drawing.Image[items.Count]; int index = dataGridView1.SelectedRows[0].Index; realImages[index] = pictureBox1.Image; using (Preview preview = new Preview(images[index], images, realImages)) { if (preview.Ok) { preview.ShowDialog(this); } } }
private void pictureBox1_DoubleClick(object sender, EventArgs e) { var pictureBox = sender as PictureBox; Image image = (pictureBox == pictureBox1 ? image1 : image2); List <Image> images = new List <Image> { image1, image2 }; System.Drawing.Image[] realImages = new System.Drawing.Image[] { pictureBox1.Image, pictureBox2.Image }; using (Preview preview = new Preview(image, images, realImages)) { if (preview.Ok) { preview.ShowDialog(this); } } }