0

DataGridViewImage为我的DataGridView.

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;

解决!

4

1 回答 1

1

您可以像这样使用而不是使用DataGridViewImageCell cell

dataGridView1["guardar", e.RowIndex].Value = Properties.Resources.guardar_grilla;
于 2013-02-19T19:39:04.063 回答