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