c# - changing DataGridviewCellStyle on RowIndex 0 -


i use following code change cell style in cellenter event of datagridview. if remove if-statement rows formated bold after databinding. tip or advice ?

datagridviewcellstyle ostyle = new datagridviewcellstyle();             ostyle.font = new font("microsoft sans serif", 9.25f, fontstyle.bold);              if (e.rowindex > 0)             {                 datagridview1.rows[e.rowindex].cells[0].style = ostyle;                 datagridview1.rows[e.rowindex].cells[1].style = ostyle;                 datagridview1.rows[e.rowindex].cells[2].style = ostyle;                 datagridview1.rows[e.rowindex].cells[3].style = ostyle;                 datagridview1.rows[e.rowindex].cells[4].style = ostyle;                 datagridview1.rows[e.rowindex].cells[5].style = ostyle;                 datagridview1.rows[e.rowindex].cells[6].style = ostyle;                 datagridview1.rows[e.rowindex].cells[7].style = ostyle;                 datagridview1.rows[e.rowindex].cells[8].style = ostyle;             } 

if understand right behavior expected. can try add above code cellmouseclick event.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -