mercredi 8 avril 2020

DataGridView First Check Cell Visually Empty When Checking All

I have a DataGridView with a Check Cell Column that I can simply check all by calling:

foreach (DataGridViewRow row in dataGridView1.Rows)
{
     row.Cells[0].Value = true;
}

Functionally, all the cells are checked, however, the first check cell in row 0 is always visually empty until I manually click into any cell of the DataGridView.

At first, I thought it was maybe because the default highlighting/selection of a cell was causing it to not show. So I disabled it upon load:

dataGridView1.CurrentCell.Selected = false;

While no cells are highlighted, the problem still persists and I have to manually click into the DataGridView to "refresh" the first checkbox. I've also tried adding:

dataGridView1.Update();
dataGridView1.Refresh();

The problem still exists. Is there something I am missing about correctly checking my cell boxes? Why is my first checkbox cell always visually empty even though it is really "checked/true"?

The only way I can get it to refresh is by raising a "mouse click" into my DataGridView.




Aucun commentaire:

Enregistrer un commentaire