0
我最近正在使用类型化的Datagridview从用户获取数据,如姓名,手机号码和用户图像。用户可以输入名称和手机号码,但是如何在Datagridview中获取图像?以及如何在DataGridView图像单元存储在SQL Server 2008如何在类型化的datagridview图像列中加载和保存图像?
这里是我的编码:
private void dataGridViewEx1_CellContentDoubleClick
(object sender, DataGridViewCellEventArgs e)
{
OpenFileDialog Dilg = new OpenFileDialog();
DialogResult DRR = Dilg.ShowDialog();
if (DRR == DialogResult.OK)
{
if (e.RowIndex != -1)
{
dataGridViewEx1.Rows[e.RowIndex].Cells[33].Value = Image.FromFile(Dilg.FileName);
dataGridViewEx1.Refresh();
Application.DoEvents();
}
else
{
XtraMessageBox.Show("Out Of Range", "Information");
}
}
else
{
return;
}
}
但是使用这个代码加载图像之后。 Datagridview图像单元中的图像加载,但其他细节(如名称和移动设备无法从同一列删除)。
如何在不擦除其他列数据的情况下加载图像?