c# - Change specific word color in gridview -
i'm creating winforms
application represents data user. in data, want highlight words specific colors. can in asp.net
application adding style sheet , use in grid-view in answer. how can achieve same result in winforms gridview
?
i'm using code below changes color whole cell, want change color of word.
private void datagridview1_databindingcomplete(object sender, datagridviewbindingcompleteeventargs e) { foreach (datagridviewrow row in datagridview1.rows) { foreach (datagridviewcell cell in row.cells) { foreach( string word in wordss) if (cell.value.tostring().toupper().contains(word.toupper())) { cell.style.backcolor = color.red; } } } }
you need use cellpainting event customize how cell drawn. check answer, hope you.
Comments
Post a Comment