if ((e.ColumnIndex == this.dataGridView1.Columns["stat"].Index) && e.Value != null) { DataGridViewCell cell = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex]; if (e.Value.Equals("0")) { e.Graphics.FillRectangle(brush, face); } else if (e.Value.Equals("1")) { e.Graphics.FillRectangle(brush1, face); } }
DataGridViewRow row = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex]; if (row.Cells[2].Value != null) { if (Int32.TryParse(row.Cells[2].Value.ToString(), out Int32 value)) { if (value == 0) { e.Graphics.FillRectangle(brush, face); } else { e.Graphics.FillRectangle(brush1, face); } } }
CellFormatting
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)