0
我做固定我如何插入圖像插入從DataGridView PictureBox的,但問題是代碼,它只能顯示第一行上的圖像,這裏是我的代碼PictureBox中不顯示其他的圖像
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count > 0)
{
byte[] imagebyte = (byte[])dataGridView1.Rows[0].Cells["Picture"].Value;
MemoryStream ms = new MemoryStream();
ms.Write(imagebyte, 0, imagebyte.Length);
Bitmap bmp = new Bitmap(ms);
pictureBox2.Image = bmp;
}
}
我覺得問題是在byte[] imagebyte = (byte[])dataGridView1.Rows[0].Cells["Picture"].Value;
的代碼中,我不知道用什麼代碼將rows [0]替換成選定的索引。 謝謝:)
謝謝,真的解決我的問題! :) – Pyromancer 2013-02-14 08:46:08