private void pictureBox1_DoubleClick(object sender, EventArgs e) { DataGridView dv = this.dataGridView1; if (dv != null && dv.CurrentRow != null) { string imgFile = Server.ConfigHelper.UpLoadPath + dv.CurrentRow.Cells["fileUrl"].Value.ToString(); if (File.Exists(imgFile)) { Pic_show fd = new Pic_show(imgFile); fd.ShowDialog(); } } }
private void listDouble(object sender, EventArgs e) { string imgFile = ""; ListView lv = sender as ListView; int selectCount = lv.SelectedItems.Count; if (selectCount > 0)//若selectCount大于0,说明用户有选中某列。 { imgFile = lv.SelectedItems[0].SubItems[0].Name; } Pic_show fd = new Pic_show(imgFile); fd.ShowDialog(); }