DataGridViewImageCell未显示图像
本文关键字:图像 显示图 显示 DataGridViewImageCell | 更新日期: 2023-09-27 18:00:06
我已经为DataGridView
创建了一个DataGridViewImage
列。
DataGridViewImageColumn guardar = new DataGridViewImageColumn();
{
guardar.HeaderText = "";
guardar.Name = "guardar";
guardar.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
guardar.CellTemplate = new DataGridViewImageCell();
guardar.Image = Properties.Resources.empty_grilla;
guardar.ToolTipText = "Guardar";
}
dgv_Bancos.Columns.Add(guardar);
问题是,当我想更改特定单元格的图像时,它不会更改。
这是我的代码,请帮忙,我不知道出了什么问题
DataGridViewImageCell cell = (DataGridViewImageCell)dgv_Bancos.Rows[e.RowIndex].Cells["guardar"];
cell.Value = Properties.Resources.guardar_grilla;
已解决
您可以这样使用,而不是使用DataGridViewImageCell cell
dataGridView1["guardar", e.RowIndex].Value = Properties.Resources.guardar_grilla;