点击dgv某列的单元格时触发事件的方法
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 1) //第一列是 ID (隐藏),第二列才是图片(Pic)列
{
int rowIndex = this.dataGridView1.CurrentRow.Index; // 取得当前单元格的行Index
string pic = dataGridView1.Rows[rowIndex].Cells["Pic"].Value.ToString();
byte[] str = Convert.FromBase64String(pic);
Image image = GetImage(str);
this.pictureBox1.Image = image;
}

浙公网安备 33010602011771号