How can I change a row color by a data value

I want to change a row color to red when a data value == 1. How can I do that in datagrid in C# winForm?

3 Replies

SI SiD October 6, 2005 02:09 PM UTC

Override the paint method. Object o = this.DataGridTableStyle.DataGrid[rowNum,]; int chk = Convert.ToInt32(o); if(chk == 1) { foreBrush = new SolidBrush(Color.Blue); }


SI SiD October 6, 2005 02:09 PM UTC

Override the paint method. Object o = this.DataGridTableStyle.DataGrid[rowNum,]; int chk = Convert.ToInt32(o); if(chk == 1) { foreBrush = new SolidBrush(Color.Blue); }


SI SiD October 6, 2005 02:09 PM UTC

Override the paint method. Object o = this.DataGridTableStyle.DataGrid[rowNum,]; int chk = Convert.ToInt32(o); if(chk == 1) { foreBrush = new SolidBrush(Color.Blue); } >I want to change a row color to red when a data value == 1. >How can I do that in datagrid in C# winForm?

Loader.
Up arrow icon